CAn we capture the JOBSTATUS in After job subroutine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
anshumangupta1206
Participant
Posts: 42
Joined: Tue Jan 24, 2006 9:11 am

CAn we capture the JOBSTATUS in After job subroutine

Post by anshumangupta1206 »

I am trying to get the JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

and then checking the status as follows
If JobStatus = DSJS.RUNFAILED Then

Reply = DSSendMail(InputArg)

End

but the status check is not working..

Is it something that we cant' check the status in the after job subroutine
wed
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

The job is still running when the after job routine kicks off. So the status still shows running and then it fails.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Exactly. So use a Sequence job to do the check after the job completes and to conditionally send the email.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anshumangupta1206
Participant
Posts: 42
Joined: Tue Jan 24, 2006 9:11 am

Re: CAn we capture the JOBSTATUS in After job subroutine

Post by anshumangupta1206 »

Thanks, now got it done though a seaprate subroutine
anshumangupta1206 wrote:I am trying to get the JobStatus = DSGetJobInfo(JobHandle, DSJ.JOBSTATUS)

and then checking the status as follows
If JobStatus = DSJS.RUNFAILED Then

Reply = DSSendMail(InputArg)

End

but the status check is not working..

Is it something that we cant' check the status in the after job subroutine
wed
katz
Charter Member
Charter Member
Posts: 52
Joined: Thu Jan 20, 2005 8:13 am

Post by katz »

hi anshumangupta1206,

I have noticed that the Job Report when executed in an After-job routine (DSMakeJobReport using handle DJS.ME) captures the correct job status. At least this is true when outputing an XML job report - I have not tested the other report levels.

It would be possible for you to extract the job's status from the job report and use the extracted value for the decision to send a mail.

katz
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can do this by asking for the "interim status" - the status that the job would have if its after-job subroutine weren't keeping it running.

Code: Select all

DSGetJobInfo(DSJ.ME, DSJ.JOBINTERIMSTATUS)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply