resetting and rerunning a job from a basic datatstage job
Posted: Fri Dec 14, 2001 5:28 pm
Hi,
I wonder if someone could help me on the following.
What I want to do is start a Datastage job from a basic Datastage controlling job. When the started job aborts, I want to reset it and run it again , this maximum 5 times. Ill try to do this because sometimes jobs abends and when one starts them again they run ok. So instead of doing this manually I want to solve it in the basic controlling job
For testing I have put an error in this GRCRESTART1 The first time GRCRESTART1 aborts
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives
a 3
after resetting the job and restarting it
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives
a 1 indicating that the job finished normally although it also aborted.
maybe Im overlooking the obvious but I couldnt manage to solve it
thanks in advance
Luc
jobname = "GRCRESTART1"
gosub runjob:
return
runjob:
*
Trialruns = 0
Loop
While Trialruns < 5
hJob1 = DSAttachJob(jobname, DSJ.ERRWARN)
If NOT(hJob1) Then
Call DSLogFatal("Job Failed: " :jobname , "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "ERRDIR", ERRDIR)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives a 3 the first time and a 1 the second time
Call DSLogWarn("after run" : RunStatus ,JobName)
If RunStatus = 3 Then
ErrCode = DSDetachJob(hJob1)
hJob2 = DSAttachJob(jobname, DSJ.ERRWARN)
ErrCode = DSRunJob(hJob2, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob2)
ResetStatus = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
ErrCode = DSDetachJob(hJob2)
Trialruns = Trialruns + 1
End
Repeat
Luc Huygelen
Data Engineering
EDS (Electronic Data Systems)
Noorderlaan 147
2030 Antwerpen (Belgium)
* +32 (0)3 544 6026 or 8932 6026
> * luc.huygelen@eds.com
>
>
>
I wonder if someone could help me on the following.
What I want to do is start a Datastage job from a basic Datastage controlling job. When the started job aborts, I want to reset it and run it again , this maximum 5 times. Ill try to do this because sometimes jobs abends and when one starts them again they run ok. So instead of doing this manually I want to solve it in the basic controlling job
For testing I have put an error in this GRCRESTART1 The first time GRCRESTART1 aborts
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives
a 3
after resetting the job and restarting it
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives
a 1 indicating that the job finished normally although it also aborted.
maybe Im overlooking the obvious but I couldnt manage to solve it
thanks in advance
Luc
jobname = "GRCRESTART1"
gosub runjob:
return
runjob:
*
Trialruns = 0
Loop
While Trialruns < 5
hJob1 = DSAttachJob(jobname, DSJ.ERRWARN)
If NOT(hJob1) Then
Call DSLogFatal("Job Failed: " :jobname , "JobControl")
Abort
End
ErrCode = DSSetParam(hJob1, "ERRDIR", ERRDIR)
ErrCode = DSRunJob(hJob1, DSJ.RUNNORMAL)
ErrCode = DSWaitForJob(hJob1)
RunStatus = DSGetJobInfo(hJob1, DSJ.JOBSTATUS) gives a 3 the first time and a 1 the second time
Call DSLogWarn("after run" : RunStatus ,JobName)
If RunStatus = 3 Then
ErrCode = DSDetachJob(hJob1)
hJob2 = DSAttachJob(jobname, DSJ.ERRWARN)
ErrCode = DSRunJob(hJob2, DSJ.RUNRESET)
ErrCode = DSWaitForJob(hJob2)
ResetStatus = DSGetJobInfo(hJob2, DSJ.JOBSTATUS)
ErrCode = DSDetachJob(hJob2)
Trialruns = Trialruns + 1
End
Repeat
Luc Huygelen
Data Engineering
EDS (Electronic Data Systems)
Noorderlaan 147
2030 Antwerpen (Belgium)
* +32 (0)3 544 6026 or 8932 6026
> * luc.huygelen@eds.com
>
>
>