Pass the Fatal Error Message between jobs as parameters

*A simple server routine to get the fatal errors from failed job and it can passed as parameter to next job as one 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)

Leave a Reply

Your email address will not be published. Required fields are marked *