View previous topic :: View next topic
|
Author |
Message |
Digvijay Singh
Active User
Joined: 20 Apr 2022 Posts: 148 Location: India
|
|
|
|
Hi all,
I have a problem statement here.
I have one job(A job) which is triggered by rexx and it release one file and that file is triggering one another job (job B) the purpose of that B job is to capture the return code of job A and basis of return code of job A.
what problem i am facing?
When I am executing this flow my B job is not able to capture the A job(A job finished adn file is created in A job that triggred B job) from Savers may be bcz it is not available in the savers yet and this flow is executing this B job .
Points to be noted:
1> This is part of automation task.
2>My A job name is dynamic but i hv used some logic and able to capture the name of the job to get captured in My B job.
3>Problem is the log capturing step in my B job is getting executed right before even the A job is available in savers.
I am trying to add wait step in my B job to wait for 60's and so that it can capture the A job logs but my code reviewer is saying I should not do this since it is not a good practice . I have tested this for few test cases and it worked but they are saying your job might take more time you will have a problem in that situation.
An i can't think of any other way here , Can anyone give any suggest or guide me here.
Thanks in advance. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Can you try checking after every 30 seconds invterval until you get rc of job A or iteration is 5 times ( whichever is earlier) before erroring out? That would give a range of 30-159 seconds |
|
Back to top |
|
|
Digvijay Singh
Active User
Joined: 20 Apr 2022 Posts: 148 Location: India
|
|
|
|
Thank you for reply,
But how even 159 second is not enough if the job is running for more than 159 second.
We dnt know the timing of job it can finish in 0.6 sec or may take more time.
Looking for some dynamic logic here.
one more question is this below scenario is possible in scheduling toll opcp?
If I pass a file with job name can you do something in opcp ..like it should search for that job and if it is available in savers it should trigger another job..?
Thanks for reply |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
How about not triggering the job B from Job A so early and do it at the end step of Job A then you don’t need all these worry ? |
|
Back to top |
|
|
Digvijay Singh
Active User
Joined: 20 Apr 2022 Posts: 148 Location: India
|
|
|
|
Still my job A might be running and my step in job B (log capturing step) will start executing and gets finished without capturing the logs.
Can we put or check A job logs any way through rexx or anyway and keep that code in loop untill RC code is not available...? |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Why would Job A run if there are no more steps in it? You can then make a use of job scheduling feature , and do job as successor to job A |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Why not to use the simplest solution, with reservation of the same dataset?
Code: |
//JOBA JOB
//MAINTASK EXEC PGM=specpgm
// . . . . . . . . . . . . .
//* now save the result of MAINTASK step
//* in the common dataset ...JOBA.RETCODE
// IF (RC.MAINTASK = 0) THEN
//SAVERC0 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN DD DUMMY
//SYSUT1 DD *
JOBA RC = 0
//*
//SYSUT2 DD DISP=OLD,DSN=&SYSUID..JOBA.RETCODE
//*
// ELSE
//SAVERC4 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN DD DUMMY
//SYSUT1 DD *
JOBA RC = 4 OR HIGHER
//*
//SYSUT2 DD DISP=OLD,DSN=&SYSUID..JOBA.RETCODE
//*
// ENDIF
// |
JOBB below will be blocked by zOS due to "WAITING FOR DATASETS", because of DISP=OLD in both jobs.
Code: |
//JOBB JOB
//WAITING EXEC PGM=rcreader
//GETRC DD DISP=OLD,DSN=&&SYSUID..JOBA.RETCODE
// . . . . . . . . . . . . . . .
//* Do whatever the RCREADER program has detected from the passed dataset
//* It may even return the same RC just read from the dataset,
//* as its own RC to be checked by later steps of JOBB
// . . . . . . . . . . . .
// |
|
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1335 Location: Bamberg, Germany
|
|
|
|
Just a remark, sometimes these "WAITING FOR DATASETS" msgs are automated and cause tickets.
It should be (just one '&' here):
Code: |
//GETRC DD DISP=OLD,DSN=&SYSUID..JOBA.RETCODE |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
Joerg.Findeisen wrote: |
Just a remark, sometimes these "WAITING FOR DATASETS" msgs are automated and cause tickets.
It should be (just one '&' here):
Code: |
//GETRC DD DISP=OLD,DSN=&SYSUID..JOBA.RETCODE |
|
WAITING FOR DATASETS is a typical situation in many cases...
It's almost the same as pedestrians waiting for green traffic light
They usually do not get any ticket
Double '&&' is my typo, sorry. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2141 Location: USA
|
|
|
|
As a free gift: an example of possible step //WAITING of the //JOBB
Code: |
//WAITING EXEC PGM=SORT,PARM='NULLOUT=RC4'
//SYSOUT DD DUMMY
//SORTIN DD DISP=OLD,DSN=&SYSUID..JOBA.RETCODE
//SORTOUT DD DUMMY,DCB=(&SYSUID..JOBA.RETCODE)
//SYSIN DD *
INCLUDE COND=(1,20,SS,EQ,C' RC = 0 ')
SORT FIELDS=COPY,STOPAFT=1 (fool-proof against false datasets)
END
//*
// IF (RC.WAITING = 0) THEN
//* do whatever is needed when RC from JOBA is 0
// . . . . . . . . . . . . . . . . . . . .
// ELSE
//* do whatever is needed when RC from JOBA is not 0
// . . . . . . . . . . . . . . . . . . . .
// ENDIF
// |
|
|
Back to top |
|
|
|