sirs,
i m running a job through batch i want to rest the aborted job before runing how can i do in batch?
please advice ,
thanks in advance
reset the jobs
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Create your batch as a job sequence and use "Reset if required, then run" as the run method in each Job activity.
That will do it for you.
Optionally inspect the generated job control code, look for calls to DSPrepareJob() - this is how you would do it if you cut your own code.
From the traditional batch, created in Director and having a name beginning with "Batch::", it is not possible to do what you seek without editing the generated code.
That will do it for you.
Optionally inspect the generated job control code, look for calls to DSPrepareJob() - this is how you would do it if you cut your own code.
From the traditional batch, created in Director and having a name beginning with "Batch::", it is not possible to do what you seek without editing the generated code.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
reset the jobs
sirs,
thanks for ur response
i m using the below code
* Check job JOBSTATUS. If the status is abort then reset the job before running
handle1 = DSAttachJob("job", DSJ.ERRFATAL)
Status = DSGetJobInfo(handle1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
ErrCode = DSRunJob(handle1, DSJ.RUNRESET)
End
handle2 = DSAttachJob("job", DSJ.ERRFATAL)
ErrCode = DSRunJob(handle1, DSJ.RUNNORMAL)
when the job is in aborted mode the job gets reseted and sequences fails issuing the below error
job is in already locked state invalid job handle(-2)
Thanks in advance
thanks for ur response
i m using the below code
* Check job JOBSTATUS. If the status is abort then reset the job before running
handle1 = DSAttachJob("job", DSJ.ERRFATAL)
Status = DSGetJobInfo(handle1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
ErrCode = DSRunJob(handle1, DSJ.RUNRESET)
End
handle2 = DSAttachJob("job", DSJ.ERRFATAL)
ErrCode = DSRunJob(handle1, DSJ.RUNNORMAL)
when the job is in aborted mode the job gets reseted and sequences fails issuing the below error
job is in already locked state invalid job handle(-2)
Thanks in advance
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That's for non-obvious reasons. You need a fresh attachment.
Code: Select all
handle1 = DSAttachJob("job", DSJ.ERRFATAL)
Status = DSGetJobInfo(handle1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Or Status = DSJS.STOPPED Then
ErrCode = DSRunJob(handle1, DSJ.RUNRESET)
ErrCode = DSDetachJob(handle1) ; * <---
End
handle2 = DSAttachJob("job", DSJ.ERRFATAL)
ErrCode = DSRunJob(handle2, DSJ.RUNNORMAL) ; * <---
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
use the DSPrepareJob function
Used to ensure that a compiled job is in the correct state to be run or validated.
Syntax
JobHandle = DSPrepareJob(JobHandle)
JobHandle is the handle, as returned from DSAttachJob(), of the job to be prepared.
JobHandle is either the original handle or a new one. If returned as 0, an error occurred and a message is logged.
Example
h$ = DSPrepareJob(h$)
Danny
Syntax
JobHandle = DSPrepareJob(JobHandle)
JobHandle is the handle, as returned from DSAttachJob(), of the job to be prepared.
JobHandle is either the original handle or a new one. If returned as 0, an error occurred and a message is logged.
Example
h$ = DSPrepareJob(h$)
Danny