Page 1 of 1

CAn we capture the JOBSTATUS in After job subroutine

Posted: Thu Aug 24, 2006 6:10 am
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

Posted: Thu Aug 24, 2006 6:50 am
by kduke
The job is still running when the after job routine kicks off. So the status still shows running and then it fails.

Posted: Thu Aug 24, 2006 7:13 am
by chulett
Exactly. So use a Sequence job to do the check after the job completes and to conditionally send the email.

Re: CAn we capture the JOBSTATUS in After job subroutine

Posted: Thu Aug 24, 2006 8:34 am
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

Posted: Thu Aug 24, 2006 9:33 am
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

Posted: Fri Aug 25, 2006 1:49 am
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)