Reseting and Running a Job from Routine
Posted: Fri Jul 10, 2009 5:12 am
Here is the piece of code
When the job is in runnable state, this routines works fine and run it. When the job is not in runnable state, it resets it but do not run the job.
My requirement is that it should reset as well run the job if the job is in not runnable state.
Pls advice where I am missing
Code: Select all
$INCLUDE DSINCLUDE JOBCONTROL.H
JobName=Trim(Arg1)
JobHandle = DSAttachJob (JobName, DSJ.ERRWARN)
Status = DSGetJobInfo (JobHandle, DSJ.JOBSTATUS)
If Status= DSJS.RUNFAILED or Status= DSJS.CRASHED
THEN
ErrCode=DSRunJob(JobHandle , DSJ.RUNRESET )
ErrCode=DSWaitForJob(JobHandle)
END
ErrCode=DSRunJob(JobHandle , DSJ.RUNNORMAL )
ErrCode=DSWaitForJob(JobHandle)
ErrCode=DSDetachJob(JobHandle)
Ans=ErrCode
My requirement is that it should reset as well run the job if the job is in not runnable state.
Pls advice where I am missing