Retrieve Fatal Error from DataStage Job

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
pran.praveen
Premium Member
Premium Member
Posts: 20
Joined: Tue Jun 22, 2010 9:02 am

Retrieve Fatal Error from DataStage Job

Post 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.
Praveen
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post 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
rkashyap
Premium Member
Premium Member
Posts: 532
Joined: Fri Dec 02, 2011 12:02 pm
Location: Richmond VA

Post by rkashyap »

Ideal solution - leverage DSODB. Also see this post.
johnboy3
Premium Member
Premium Member
Posts: 52
Joined: Fri Jun 19, 2015 2:48 pm
Location: Jackson, MS, USA

link does not work

Post 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
john3
----------------------------------------------------
InfoSphere 8.5.0.2; DataStage 8.5.0.0; OS-RHEL 6.6; DB-Oracle Enterprise Edition 11g (11.2.0.4)
johnboy3
Premium Member
Premium Member
Posts: 52
Joined: Fri Jun 19, 2015 2:48 pm
Location: Jackson, MS, USA

Re: link does not work

Post 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
john3
----------------------------------------------------
InfoSphere 8.5.0.2; DataStage 8.5.0.0; OS-RHEL 6.6; DB-Oracle Enterprise Edition 11g (11.2.0.4)
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
johnboy3
Premium Member
Premium Member
Posts: 52
Joined: Fri Jun 19, 2015 2:48 pm
Location: Jackson, MS, USA

Post by johnboy3 »

Thank you so much!
Sorry for the "beginner troubles."
john3
john3
----------------------------------------------------
InfoSphere 8.5.0.2; DataStage 8.5.0.0; OS-RHEL 6.6; DB-Oracle Enterprise Edition 11g (11.2.0.4)
Post Reply