I am having a requirement where I need to design an After Job Subroutine that will be called in each job via job properties.
As soon as the job has status aprt from Finished OK, the after job subroutine should be called and it should reset the job. I wrote the following code: -
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
Input=Trim(InputArg)
JobStatus = DSGetJobInfo(DSJ.ME,DSJ.JOBINTERIMSTATUS)
If JobStatus ne 1
Then ErrCode = DSRunJob(DSJ.ME,DSJ.RUNRESET)
Else ErrCode = 0
ErrorCode = ErrCode;
The above code is not giving any result. I think DSJ.ME does not run with ErrCode. When I wrote a separate function with following code then it reset the job for which the job name is provided: -
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
Input=Trim(InputArg)
handle = DSAttachJob(Input,DSJ.ERRFATAL)
JobStatus = DSGetJobInfo(handle,DSJ.JOBSTATUS)
If JobStatus ne 1
Then ErrCode = DSRunJob(handle,DSJ.RUNRESET)
Else ErrCode = 0
DSDetachJob(handle)
ErrorCode = ErrCode;