We have a requirement to capture the error message of an aborted job and send the message by email. We need to capture the exact error message that is displayed in the director log. Please provide any inputs on this.
Thanks in advance
How to capture error message of a job and send it in mail
Moderators: chulett, rschirm, roy
I have a similar issue. I need to capture the job status and in case of failure, I need to send out an email notification. To do this I created a server routine that is coded as follows:
Deffun DSRMessage(A1) Calling "*DataStage*DSR_MESSAGE"
Equate RoutineName To "SendMessageOnFailure"
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode=0
JobNm=DSGetJobInfo(JobName,DSJ.JOBNAME)
JobStat=DSGetJobInfo(JobName,DSJ.JOBINTERIMSTATUS)
Call DSLogInfo("Job ":JobNm:" Status:":JobStat, RoutineName)
If JobStat<>1
Then the sequence job faile
Ans = DSSendMail("From:aaa@xxx.com\nTo:bbb@xxx.com\nSubject:Job Failure\nBody:Failed to load successfully\n")
End
I set up a sequence job to call this routine. However the sequence job fails. I am not sure if this is the right approach, but perhaps someone else has some ideas?
Deffun DSRMessage(A1) Calling "*DataStage*DSR_MESSAGE"
Equate RoutineName To "SendMessageOnFailure"
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode=0
JobNm=DSGetJobInfo(JobName,DSJ.JOBNAME)
JobStat=DSGetJobInfo(JobName,DSJ.JOBINTERIMSTATUS)
Call DSLogInfo("Job ":JobNm:" Status:":JobStat, RoutineName)
If JobStat<>1
Then the sequence job faile
Ans = DSSendMail("From:aaa@xxx.com\nTo:bbb@xxx.com\nSubject:Job Failure\nBody:Failed to load successfully\n")
End
I set up a sequence job to call this routine. However the sequence job fails. I am not sure if this is the right approach, but perhaps someone else has some ideas?
I apologize. I made a slight mistake in the code. Here it is:
Deffun DSRMessage(A1) Calling "*DataStage*DSR_MESSAGE"
Equate RoutineName To "SendMessageOnFailure"
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode=0
JobNm=DSGetJobInfo(JobName,DSJ.JOBNAME)
JobStat=DSGetJobInfo(JobName,DSJ.JOBINTERIMSTATUS)
Call DSLogInfo("Job ":JobNm:" Status:":JobStat, RoutineName)
If JobStat<>1
Ans = DSSendMail("From:aaa@xxx.com\nTo:bbb@xxx.com\nSubject:Job Failure\nBody:Failed to load successfully\n")
End
Deffun DSRMessage(A1) Calling "*DataStage*DSR_MESSAGE"
Equate RoutineName To "SendMessageOnFailure"
$INCLUDE DSINCLUDE JOBCONTROL.H
ErrorCode=0
JobNm=DSGetJobInfo(JobName,DSJ.JOBNAME)
JobStat=DSGetJobInfo(JobName,DSJ.JOBINTERIMSTATUS)
Call DSLogInfo("Job ":JobNm:" Status:":JobStat, RoutineName)
If JobStat<>1
Ans = DSSendMail("From:aaa@xxx.com\nTo:bbb@xxx.com\nSubject:Job Failure\nBody:Failed to load successfully\n")
End
-
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India