DSGetJobInfo for current job always return 0

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
cheerfu1
Participant
Posts: 37
Joined: Mon Apr 21, 2003 8:47 pm

DSGetJobInfo for current job always return 0

Post by cheerfu1 »

This will always return 0. Is there anyway to get the correct state of the current job? Thank you in advance :roll:

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

RoutineName = 'isFinished'

Output = 0
SystemReturnCode = 0
JobStatus = DSGetJobInfo(DSJ.ME, DSJ.JOBSTATUS)

Call DSLogInfo(JobStatus, "IsFinished")

ErrorCode = 0      ;* set this to non-zero to stop the stage/job
If JobStatus = 0 or JobStatus = 1 or JobStatus = 2 Then
   ExecName = 'touch ' : InputArg : '.test'
   Call DSExecute('DOS', ExecName, Output, SystemReturnCode)
   ErrorCode = 0
   RETURN
End Else
   Call DSLogInfo(JobStatus, "IsFinished")
   ErrorCode = JobStatus 
   RETURN
End
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where are you executing this code? If - as seems to be the case - you're executing it from within a routine - even an after-job routine - the status of the job will always - necessarily - be 0 ("running").

You can, in an after-job subroutine, use the "interim status" argument to DSGetJobInfo. Research on-line help for exact details.
Alternately, you must query the job after it finishes completely. This might be via the $JobStatus variable in a job sequence, or in your own routine in which you explicitly attach, interrogate and detach the job in question.
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