DSWaitForJob
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
DSWaitForJob
I need to wait for 4 or 5 sequences to run before I run another sequence. But these 4 or 5 sequences come within a span of 2 weeks to 1 month. How do I remove the time out option (or) specify particular time for time out??
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
I created a new job and had this as first job in a sequence, where I want to wait for two jobs to be completed, before I could move on. I am using the following code in the job control, but this job doesn't wait at all. It compiles and runs properly. and then proceeds to next job in a sequence (I even had conditional ok in the trigger field).
I tried to write a routine and called it from before/after routines. But upon compilation I get warnings that there are no stages in the job.
What am i doing wrong?
Code: Select all
ErrorCode = 0
rtnName = "Wait"
* Attach to Job
jobHandle1 = DSAttachJob(iJob1, DSJ.ERRWARN)
If jobHandle1 = 0 Then
Call DSLogFatal("Invalid job name : ":iJob1,rtnName)
End
* Attach to Job
jobHandle2 = DSAttachJob(iJob2, DSJ.ERRWARN)
If jobHandle2 = 0 Then
Call DSLogFatal("Invalid job name : ":iJob2,rtnName)
End
ErrorCode= DSWaitForJob (jobHandle1:',':jobHandle2)
What am i doing wrong?
Hi,
hJobU2PM23 is the job handle from DSattach function for job named Updatejob
ErrCode = DSWaitForJob(hJobU2PM23)
Status = DSGetJobInfo(hJobU2PM23, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: Updatejob", "JobControl")
End
Use this code at completion of first job and before start of next job
Ketfos
hJobU2PM23 is the job handle from DSattach function for job named Updatejob
ErrCode = DSWaitForJob(hJobU2PM23)
Status = DSGetJobInfo(hJobU2PM23, DSJ.JOBSTATUS)
If Status = DSJS.RUNFAILED Then
* Fatal Error - No Return
Call DSLogFatal("Job Failed: Updatejob", "JobControl")
End
Use this code at completion of first job and before start of next job
Ketfos
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 97
- Joined: Tue Feb 21, 2006 6:45 am
For a while I thought I figured out how to do it.
Next approach what I can think of is to write files from Seq1 and Seq2, and Seq3 Waits for those 2 files written by Seq1, Seq2, using Wait for File Activity (with Do not time out checked).
After that I remove those files (which I will use just to indicate status).
Is this a good approach or should I use another approach?
Next approach what I can think of is to write files from Seq1 and Seq2, and Seq3 Waits for those 2 files written by Seq1, Seq2, using Wait for File Activity (with Do not time out checked).
After that I remove those files (which I will use just to indicate status).
Is this a good approach or should I use another approach?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
That's a good approach; if you understand it and can maintain it, it's probably the right approach.
If you can afford to have long-running jobs, you might consider a job sequence that does what you require. Use "All" sequencers to govern what executes when.
If you can afford to have long-running jobs, you might consider a job sequence that does what you require. Use "All" sequencers to govern what executes when.
Code: Select all
Seq1 ------>
A -------> Seq4 -----> A
Seq2 ------> L L -----> Seq6
L -------> Seq5 -----> L
Seq3 ------>
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.
Wait for File Activity is used just for synchronization isnt it??? I guess here the Seq3 need to be started by dsjob or DSRunJob??Next approach what I can think of is to write files from Seq1 and Seq2, and Seq3 Waits for those 2 files written by Seq1, Seq2, using Wait for File Activity ( with Do not time out checked ).
Where will it be appropriate to introduce this dsjob or DSRunJob?