Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
JCL submitting JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jzhardy

New User


Joined: 31 Oct 2006
Posts: 77
Location: brisbane

PostPosted: Thu Jul 09, 2020 3:14 pm    Post subject: JCL submitting JCL
Reply with quote

I have a specific requirement to submit JCL within a Job, using the internal reader. So, Job X invokes Job Y.

This can be done easily using IEBGENER. But what I need to do is hold the submitting job (X) until the called job (Y) has finished.

The proper solution is to use a job scheduler like OPC. However, for various reasons, I need to use an alternative approach for the time being.

My solution was:

Job X :
Step1 : submit job Y
Step2 : wait 10 seconds, to give time for Y to enqueue file resource
Step3 : take MOD lock on that file resource


Step3 has the effect of holding Job X until Job Y finishes and releases file resource.

Worked perfectly under Z/OS 2.2.
Fails under Z/OS 2.3 for reason/s unknown.

So ... can someone provide possible explanation .. OR provide a more elegant solution.

as I said, at this stage using OPC or Control-M is not possible.
Job Y runs under different LPAR to Job X.

Any help appreciated
Back to top
View user's profile Send private message

enrico-sorichetti

Senior Member


Joined: 14 Mar 2007
Posts: 10697
Location: italy

PostPosted: Thu Jul 09, 2020 6:32 pm    Post subject: Reply to: JCL submitting JCL
Reply with quote

split job X in two parts ...
last step of X part ONE submits Y
last step of Y submits X part TWO

remember
the topic belongs to the category of 'topics not eligible for discussion'
at the section ... write Your own scheduler

and as such should be locked
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Thu Jul 09, 2020 6:51 pm    Post subject:
Reply with quote

Consider using JOBGROUP (available since z/OS 2.2) to build your own scheduling logic w/ z/OS and JES2 means.
Back to top
View user's profile Send private message
WilliamDownie

New User


Joined: 01 Jul 2020
Posts: 3
Location: UK

PostPosted: Sun Jul 26, 2020 5:23 pm    Post subject: Reply to: JCL submitting JCL
Reply with quote

Could you give job x and job y the same job name ? Job y can then not start until job x has completed.

You say that "Job Y runs under different LPAR to Job X.", so I don't know if my suggestion will work for you.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 847
Location: The Universe

PostPosted: Sun Jul 26, 2020 6:11 pm    Post subject:
Reply with quote

Code:
//JOBX     JOB ...
//A       EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  -- Data set containing JOBY --
//SYSUT2   DD  SYSOUT=(A,INTRDR)
//SYSIN    DD  DUMMY
  ....
//LAST    EXEC PGM=IEFBR14
//LOCKDS   DD  DISP=OLD,VOL=REF=SYS1.SVCLIB,
//             DSN=a-data-set-name


//JOBY     JOB ...
  ....
//LOCK     EXEC PGM=IEFBR14
//LOCKDS   DD  DISP=OLD,VOL=REF=SYS1.SVCLIB,
//             DSN=a-data-set-name
The data set in the LOCKDS DD statement does not have to actually exist; the VOL=REF parameter just ensures there is a volume to allocate.

I did this solution something like 25 years ago. It worked like a charm. Obviously it will work on one system. For two systems, both systems must share data set ENQs. If they are not doing this, it will not work, which is probably why it did not work in the z/OS 2.2 and z/OS 2.3 environment.

z/OS gets the data set resources for all data sets specified in the JCL in a job before the first step executes, and releases data sets when the last step in the job that specifies the data set completes. The weakness in this solution is JOBY will appear to be running until JOBX actually completes.

The one job name Mr. Downie proposed will work with one system, but not multiple systems.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 2443
Location: NY,USA

PostPosted: Sun Jul 26, 2020 6:21 pm    Post subject:
Reply with quote

Hope you are doing this in test only environment, are you ?
How many times are you planning to have this loop on ? What’s the break for the loop ?

If it’s test and you know it takes say 1 min then why not just wait such time and resubmit instead of coding any fancy ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Active User


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

PostPosted: Sun Jul 26, 2020 9:58 pm    Post subject:
Reply with quote

Sample with JOBGROUP (JES2 z/OS 2.2+):
Code:
//SCHEDULE EXEC PGM=IEBGENER                     
//SYSPRINT DD SYSOUT=*                           
//SYSUT1   DD DATA,DLM=##                         
//MYGROUP  JOBGROUP                               
//JOBX     GJOB                                   
//         AFTER NAME=JOBY                       
//JOBY     GJOB                                   
//MYGROUP  ENDGROUP                               
//                                               
//JOBX     JOB ..                                 
//         SCHEDULE JOBGROUP=MYGROUP             
/*JOBPARM S=ANY                                   
//NICEGUY  EXEC PGM=IEFBR14                       
//                                               
//JOBY     JOB ..                                 
//         SCHEDULE JOBGROUP=MYGROUP             
/*JOBPARM S=ANY                                   
//LADY1ST  EXEC PGM=BPXBATCH,PARM='SH sleep 1m'   
//STDOUT   DD PATH='/dev/null'                   
//STDOUT   DD PATH='/dev/null'                   
//STDERR   DD PATH='/dev/null'                   
##                                               
//SYSUT2   DD  SYSOUT=(A,INTRDR)                 
//SYSIN    DD  DUMMY

Seems to work as desired:
Code:
$HASP890 JOB(MYGROUP)                                         
$HASP890 JOB(MYGROUP)   JOB GROUP JOB LIST                     
$HASP890                JOB NAME  JOBID     JOB STAT  COMP STAT
$HASP890                --------  --------  --------  ---------
$HASP890                JOBY      JOB65366  ACTIVE    ACTIVE   
$HASP890                JOBX      JOB65365  PEND DEP  PENDING 

and
Code:
$HASP1300 JOBX registered to job group MYGROUP         
$HASP1300 JOBY registered to job group MYGROUP         
$HASP1301 JOBY in job group MYGROUP queued for execution
$HASP373 JOBY     STARTED - WLM INIT  - SRVCLASS BATCH 
$HASP395 JOBY     ENDED - RC=0000                       
$HASP1301 JOBX in job group MYGROUP queued for execution
$HASP373 JOBX     STARTED - WLM INIT  - SRVCLASS BATCH 
$HASP395 JOBX     ENDED - RC=0000                       
$HASP1304 job group MYGROUP is complete
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. ERROR WHILE SUBMITTING LOAD JOB ANURADHA NEELAKANTAN JCL & VSAM 12 Thu Aug 25, 2016 11:50 am
No new posts Can SYSIN errors be rectified without... techie09 JCL & VSAM 17 Thu Oct 31, 2013 11:59 am
No new posts Comparing a PS & PDS, submitting ... Ani Shetty JCL & VSAM 21 Sat Jun 29, 2013 5:16 pm
No new posts specify region while submitting batch... Balaji Canabady JCL & VSAM 4 Wed Feb 29, 2012 5:00 pm
No new posts jcl error when submitting the same jo... nandeshwar JCL & VSAM 19 Tue Nov 30, 2010 12:26 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us