Datastage returns fake return code

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

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

Post by cheerfu1 »

I am using After-Job routine to create a file which indicates the job has finished. However, when I used the following code, it always return a status 0 no matter it was stopped or was run successfully. Any clue?

Code: Select all

$INCLUDE DSINCLUDE JOBCONTROL.H

RoutineName = 'isFinished'

Output = 0
SystemReturnCode = 0

Call DSExecute('DOS', 'sleep 20 s', Output, SystemReturnCode)

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 »

Code: Select all

JobStatus = 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.
cheerfu1
Participant
Posts: 37
Joined: Mon Apr 21, 2003 8:47 pm

Post by cheerfu1 »

It does not seem to run in DS 4.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

True, it was introduced in version 7.x, so you need to interrogate tha job status after the job has completed successfully. Typically this will be from the job control routine from which you requested execution of the job run. Or upgrade.
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