Thursday, 10 January 2013

Datastage Server Routine to get the Fatal Error Message

*A simple server routine to get the fatal errors from failed job and it can be passed as parameter to next job as single string and further it can be stored into a file or database.


$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = FIELD(Arg1,"|",1)
evtMessage1 = ""
hJob1 = DSAttachJob(JobName, DSJ.ERRNONE)
jobStart = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP)
latestID = DSGetNewestLogId(hJob1,DSJ.LOGANY)
For eventID = latestID To 1 Step -1
         eventDetail = DSGetLogEntry(hJob1,eventID)
         evtDate = FIELD(eventDetail,"\",1)
         evtDate = CHANGE(evtDate,"Date: ","")
         evtMessage = FIELD(eventDetail,"\",4)
         evtType = Field(eventDetail,"\",3)
         If evtDate < jobStart Then Exit
        
         
         If evtType = "3" Then
            evtMessage1 = evtMessage:"|":evtMessage1
         END
Next eventID
Ans = Lower(evtMessage1)

Stay tuned for more updates....

Thanks
Prasoon

1 comment:

  1. Hi , am sure my comment is not at the right place, but do you have any idea on the IBM workload scheduler? Needed some help there.

    ReplyDelete