Page 1 of 1

Job abort message as an attachement in email notification

Posted: Sun Oct 20, 2013 8:20 am
by DSRajesh
Dear All,

I have requirement with when ever job fails in a sequence i need to send the error message with the job failed along with job status in email notification.

I am not sure of to how to get the aborted message and send as an attchement in email

Looking farward for suggestion from any one

Thanks

Posted: Sun Oct 20, 2013 8:48 am
by chulett
The Notification Activity stage will do that automatically in a Sequence job if you enable the 'Include status' option. Now, it won't be an attachment but you should have the basic information you need with very little effort.

If what you 'need' to pull are the actual error message(s) from the job's log and attach them, you'll need some custom code that leverages the API for the various DSGetLog functions and writes that information to a flat file. The Notification Activity stage can then send that file as an attachment. Or you can script all that from the command line using dsjob and something like sendmail if (for example) you have a job 'wrapper' script that launches all of your jobs.

Posted: Sun Oct 20, 2013 9:02 am
by DSRajesh
I have checked the option "Include Job Status in Mail" and able to see all job run information including which job got aborted.

But i need to capture the error message with which job has got failed.

Can you please suggest me how can i capture the error message in email notification

Posted: Sun Oct 20, 2013 9:31 am
by DSRajesh
Chullet

Could you please suggest me some thing here

Posted: Sun Oct 20, 2013 11:20 am
by ray.wurlod
The second paragraph of Craig's post tells you what you need to do.

Posted: Mon Oct 21, 2013 4:05 am
by DSRajesh
Hi

My membership is expired and will renew in a week.

I am unable to see the remaining post send by craig.

Request you to please give the solution for the error message issue.

Posted: Mon Oct 21, 2013 4:59 am
by ArndW
It boils down to the answer that there is not built-in way to do this directly in the job, but with sendmail and the DataStage BASIC API it is possible to program this yourself.

Posted: Mon Oct 21, 2013 4:09 pm
by DSRajesh
Anrnw,

What basic api function will be helpful to extract the error mesage

Posted: Mon Oct 21, 2013 5:46 pm
by chulett
I'm not Arnd but you can check the help index and look for any that start with 'DSGetLog'.

Posted: Thu Oct 24, 2013 5:09 pm
by kduke
You could script it with the command line tools. I might of posted a script for this. Need to shell out to run script.