I am having a controler job with the following code. If it abort it should reset the job but not working.
hJob1 = DSAttachJob("TestJob", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: TestJob", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "inFile", inFile)
ErrCode = DSSetParam(hJob1, "outFile", outFile)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
Call DSLogInfo(Status,"Custom program calling":Status)
Call DSRunJob(hJob1, DSJ.RUNRESET)
End
In the above code, when it is aborting, it is successfully calling that Call DSLogInfo(Status,"Custom program calling":Status) but the it is not able to call the next statement to rest job.
any input will be a help?
Jobcontrol Reset Failure
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
The aborted job is "attach locked". You need to detach then re-attach it before you can reset it.
Would it not be easier to call DSPrepareJob() before attempting to run the job? This is the function behind the "reset if required, then run" functionality in job sequences.
Would it not be easier to call DSPrepareJob() before attempting to run the job? This is the function behind the "reset if required, then run" functionality in job sequences.
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.
-
- Premium Member
- Posts: 238
- Joined: Fri Jul 25, 2008 8:55 am
In the above code I modified the IF condition like the following . But still it is not resetting. Any help?
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
Call DSLogInfo(Status,"Custom program calling":Status)
Call DSDetachJob(hJob1)
hJob1= DSAttachJob("TestJob", DSJ.ERRFATAL)
Call DSRunJob(hJob1, DSJ.RUNRESET)
END
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
Call DSLogInfo(Status,"Custom program calling":Status)
Call DSDetachJob(hJob1)
hJob1= DSAttachJob("TestJob", DSJ.ERRFATAL)
Call DSRunJob(hJob1, DSJ.RUNRESET)
END
-
- Premium Member
- Posts: 238
- Joined: Fri Jul 25, 2008 8:55 am
Sorry. I got answer for this problem.
The code should be like this
hJob1 = DSAttachJob("TestJob", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: TestJob", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "inFile", inFile)
ErrCode = DSSetParam(hJob1, "outFile", outFile)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
DSRunJob(hJob1, DSJ.RUNRESET)
END
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
Call DSLogInfo(Status,"Custom program calling":Status)
End
The code should be like this
hJob1 = DSAttachJob("TestJob", DSJ.ERRFATAL)
If NOT(hJob1) Then
Call DSLogFatal("Job Attach Failed: TestJob", "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "inFile", inFile)
ErrCode = DSSetParam(hJob1, "outFile", outFile)
ErrCode = DSSetDisableProjectHandler(hJob1, @FALSE)
ErrCode = DSSetDisableJobHandler(hJob1, @FALSE)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
DSRunJob(hJob1, DSJ.RUNRESET)
END
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
Status = DSGetJobInfo(hJob1, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Or Status = DSJS.CRASHED Then
Call DSLogInfo(Status,"Custom program calling":Status)
End