Page 1 of 1

To Reset the DS Job if the status is Abort using Routine

Posted: Wed Oct 12, 2005 4:27 am
by pavithra_12
Hi,

Please let me know how to create a routine that checks the DS Job status and Reset if the status of the job is Abort.

Regards
Pavithra

Posted: Wed Oct 12, 2005 4:38 am
by ArndW
The routine would contain:

- a call to DSAttachJob that you wish to reset
- a call to DSGetJobInfo to get the current status
- a call to DSPrepareJob to make the job runnable

Posted: Wed Oct 12, 2005 2:58 pm
by ray.wurlod
... and a DSDetachJob to indicate that you're finished with it and another process doesn't get a "locked" message.

Posted: Thu Oct 13, 2005 5:07 am
by 120267
Hi pavithra,

This is the routine to reset the job.

$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
If DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.STOPPED or DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.RUNFAILED
or DSGetJobInfo(hJob, DSJ.JOBSTATUS) = DSJS.CRASHED
Then
Message = "Job is resetting..."
Call DSLogInfo(Message, RoutineName)
ErrCode = DSRunJob(hJob, DSJ.RUNRESET)
Ans = ErrCode
Status = DSGetJobInfo(hJob, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
Message = "Job Reset Failed: ":hJob:"."
Call DSLogWarn(Message, RoutineName)
End
End

Thanks,
Siva

Posted: Thu Oct 13, 2005 5:12 am
by ArndW
ray.wurlod wrote:... and a DSDetachJob to indicate that you're finished with it and another process doesn't get a "locked" message.
You caught me out; I noticed the omission when I posted yesterday and was too lazy to go back and edit the post; even though I knew that you would notice and correct my error.