Page 1 of 1

Retrieve Fatal Error from DataStage Job

Posted: Thu Mar 03, 2016 11:29 pm
by pran.praveen
Hi All,
I need to retrieve the
" Fatal error messages from datastage job log for latest run " and store in the file.

If anyone has done it ,Please share . I am trying to use the
Dsjob -logsum command.

Thanks in Advance.

Posted: Fri Mar 04, 2016 2:14 am
by prasson_ibm
Hi,

Below is the basic routine, it may help you.

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H
JobName = FIELD(Arg1,"|",1)

****JobName = DSJ.ME 
hJob1 = DSAttachJob(JobName, DSJ.ERRNONE) 
jobStart = DSGetJobInfo (hJob1, DSJ.JOBSTARTTIMESTAMP) 
latestID = DSGetNewestLogId(hJob1,DSJ.LOGANY)
DIM evtVector(latestID) 
      DIM errVector(latestID) 
      DIM errTypeVector(latestID) 
 Call DSLogInfo("Job Control List: " : hJob1) 
 Call DSLogInfo("This Job name:" : hJob1)
 For eventID = latestID To 1 Step -1 
 
           eventDetail = DSGetLogEntry(hJob1,eventID)
           
          Ans = eventDetail 
          
 Next eventID

           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 = "2" Then 
            errFlag = @True 
            errVector(eventID) = evtMessage 
            errTypeVector(eventID) = "Warning" 
         End 
         If evtType = "3" Then 
            errFlag = @True 
            errVector(eventID) = evtMessage 
            errTypeVector(eventID) = "Fatal" 
         End 
If (errFlag) Then
         ErrorFile = JobStatsDir:JobName:"_Job_Errors.txt_":BatchSeq 
         OPENSEQ ErrorFile TO updFile 

           Ans =  evtType

Posted: Fri Mar 04, 2016 10:22 am
by rkashyap
Ideal solution - leverage DSODB. Also see this post.

link does not work

Posted: Fri Mar 04, 2016 1:18 pm
by johnboy3
Clicking on link takes me to the page, but NOT LOGGED IN to my premium account. I cannot see the entire message.

Clicking on "log in" at that point takes me to the "front page" of the site, and NOT THE ARTICLE.

This is compounded by the fact that searching on the site does not seem to work AT ALL.

Oh well,
john3

Re: link does not work

Posted: Fri Mar 04, 2016 1:32 pm
by johnboy3
Correcting myself!

Search works fine, if you just put in your terms and hit <enter> on the keyboard! If, however, you click the "apparent" search button, you get nothing every time. I suppose the button relates to ONLY the exact search? It looked misleading to me.

Sorry guys,
john3

Posted: Fri Mar 04, 2016 3:37 pm
by chulett
Try the link again, I have 'corrected' it I do believe. The search button runs whatever type of search you have selected via the radio button and the exact search is the only one that searches the entire database. The others only go back in time a certain number of days and thus are not really all that helpful, IMHO, so I only use exact.

Posted: Mon Mar 07, 2016 8:22 am
by johnboy3
Thank you so much!
Sorry for the "beginner troubles."
john3