Hi,
I have a dataset with several JCL-Member. All theses member can run - but how can I write a JCL, that will start one member after the other out of this dataset ?
Thanks for tips
Michael
JCL which starts other JCL
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: JCL which starts other JCL
Different options are available. The most simple one:
1) keep all required jobs one-after-one (or copy them to) a single dataset, or a single member of JCL library
2) assign exactly the same jobname to all included jobs
3) submit the whole JCL stream from this member/DSN, using a single SUBMIT command
4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT command
This is a very simple solution for this simple task, as it is described.
1) keep all required jobs one-after-one (or copy them to) a single dataset, or a single member of JCL library
2) assign exactly the same jobname to all included jobs
3) submit the whole JCL stream from this member/DSN, using a single SUBMIT command
4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT command
This is a very simple solution for this simple task, as it is described.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Global moderator
- Posts: 3720
- Joined: Sat Dec 19, 2009 8:32 pm
- Skillset: Systems programming, SAS, COBOL, CICS, JCL, SMS, VSAM, etc.
- Referer: other forum
- Location: Dubuque, Iowa, USA
Re: JCL which starts other JCL
This isn't how JES2 works. From the manual:4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT command
If the different jobs with the same name have different job classes, or have different numbers of statements, or have different priorities, then the sequence in which the jobs are executed may vary radically from the sequence the jobs were submitted in.All jobs are queued by job class, priority, and the order in which they finished conversion. This is the queue from which JES2 managed initiators select jobs for execution. See JES2 control of batch job initiation for more details.
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: JCL which starts other JCL
Take a look a JES2 scheduling services. If you can modify the jobs to use that, then you can use a simple IEBGENER to read in all the jobs and have them execute as you intend.
Otherwise you can't do it with JCL alone. If you have a WAIT program then you can submit each member by a separate IEBGENER step with a wait between, but still no guarantee.
Otherwise you can't do it with JCL alone. If you have a WAIT program then you can submit each member by a separate IEBGENER step with a wait between, but still no guarantee.
- sergeyken
- Posts: 458
- Joined: Wed Jul 24, 2019 10:12 pm
- Skillset: Assembler, JCL, Utilities, PL/I, C/C++, DB2, SQL, REXX, COBOL, etc. etc. etc.
- Referer: Internet search
Re: JCL which starts other JCL
Robert Sample wrote:This isn't how JES2 works. From the manual:4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT commandIf the different jobs with the same name have different job classes, or have different numbers of statements, or have different priorities, then the sequence in which the jobs are executed may vary radically from the sequence the jobs were submitted in.All jobs are queued by job class, priority, and the order in which they finished conversion. This is the queue from which JES2 managed initiators select jobs for execution. See JES2 control of batch job initiation for more details.
Of course, the jobs need to have the same CLASS= parameter, etc.
I expected this is obvious, and no need to clarify those details.
Javas and Pythons come and go, but JCL and SORT stay forever.
-
- Posts: 474
- Joined: Thu Mar 10, 2016 5:03 pm
- Skillset: assembler rexx zOS ispf racf smf
- Referer: saw it in the experts foprum thought I could help here
Re: JCL which starts other JCL
Strictly speaking, you cannot submit anything with JCL, but you can use JCL to run a program which can.
This will read in (submit) members from a PDS, but the order of execution may not be in that sequence, as previously discussed. It uses the standard utility IEBGENER, but other are available.
//S EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=your.pds(member1)
// DD DISP=SHR,DSN=your.pds(member2)
and so on and so forth till..
// DD DISP=SHR,DSN=your.pds(membern)
//SYSUT2 DD SYSOUT=(A,INTRDR)
Of course if you want or need something to dynamically build the list of members then you need a program, REXX springs to mind.
This will read in (submit) members from a PDS, but the order of execution may not be in that sequence, as previously discussed. It uses the standard utility IEBGENER, but other are available.
//S EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=your.pds(member1)
// DD DISP=SHR,DSN=your.pds(member2)
and so on and so forth till..
// DD DISP=SHR,DSN=your.pds(membern)
//SYSUT2 DD SYSOUT=(A,INTRDR)
Of course if you want or need something to dynamically build the list of members then you need a program, REXX springs to mind.