IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Job scheduling problem.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Digvijay Singh

New User


Joined: 20 Apr 2022
Posts: 75
Location: India

PostPosted: Mon Jul 18, 2022 8:58 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2945
Location: NYC,USA

PostPosted: Tue Jul 19, 2022 3:39 am
Reply with quote

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
View user's profile Send private message
Digvijay Singh

New User


Joined: 20 Apr 2022
Posts: 75
Location: India

PostPosted: Tue Jul 19, 2022 6:59 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2945
Location: NYC,USA

PostPosted: Tue Jul 19, 2022 12:06 pm
Reply with quote

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
View user's profile Send private message
Digvijay Singh

New User


Joined: 20 Apr 2022
Posts: 75
Location: India

PostPosted: Tue Jul 19, 2022 12:53 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2945
Location: NYC,USA

PostPosted: Tue Jul 19, 2022 1:15 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1614

PostPosted: Wed Jul 20, 2022 11:35 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 905
Location: Bamberg, Germany

PostPosted: Wed Jul 20, 2022 11:42 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1614

PostPosted: Thu Jul 21, 2022 12:19 am
Reply with quote

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 icon_biggrin.gif
They usually do not get any ticket icon_axe.gif

Double '&&' is my typo, sorry.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1614

PostPosted: Thu Jul 21, 2022 6:03 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts z/vm installation problem All Other Mainframe Topics 0
This topic is locked: you cannot edit posts or make replies. Need assistance in job scheduling logic. Mainframe Interview Questions 2
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
No new posts z/vm ipl problem All Other Mainframe Topics 5
Search our Forums:

Back to Top