Mail Notification
Posted: Tue Jun 28, 2005 9:56 am
Hi ,
I am trying to implement mail notification from a batch.I want to send an email if any job in the batch fails which will include the reason for failure.I know to implement it via graphical sequencer but not sure how to include in a batch code.
I am attaching the batch code below, please guide me how to call the DSSendMail routine in case of failure at the end of every job.
RunJobs:
* Setup XYZ, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("XYZ", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: XYZ", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "Arg1", Arg1)
ErrCode = DSSetParam(hJob1, "Arg2", Arg2)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: XYZ", "JobControl")
End
Thanks
I am trying to implement mail notification from a batch.I want to send an email if any job in the batch fails which will include the reason for failure.I know to implement it via graphical sequencer but not sure how to include in a batch code.
I am attaching the batch code below, please guide me how to call the DSSendMail routine in case of failure at the end of every job.
RunJobs:
* Setup XYZ, run it, wait for it to finish, and test for success
hJob1 = DSAttachJob("XYZ", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: XYZ", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "Arg1", Arg1)
ErrCode = DSSetParam(hJob1, "Arg2", Arg2)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: XYZ", "JobControl")
End
Thanks