JCL which starts other JCL



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

JCL which starts other JCL

Postby makdiver » Mon Oct 11, 2021 7:57 pm

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
makdiver
 
Posts: 6
Joined: Thu Jun 18, 2020 3:54 pm
Location: Switzerland
Has thanked: 0 time
Been thanked: 0 time

Re: JCL which starts other JCL

Postby sergeyken » Mon Oct 11, 2021 9:12 pm

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.
Javas come and go, but JCL stays forever.
User avatar
sergeyken
 
Posts: 216
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 5 times
Been thanked: 19 times

Re: JCL which starts other JCL

Postby Robert Sample » Mon Oct 11, 2021 11:56 pm

4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT command
This isn't how JES2 works. From the manual:
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.
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.
Robert Sample
Global moderator
 
Posts: 3664
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 272 times

Re: JCL which starts other JCL

Postby willy jensen » Tue Oct 12, 2021 1:10 am

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.
willy jensen
 
Posts: 357
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 49 times

Re: JCL which starts other JCL

Postby sergeyken » Tue Oct 12, 2021 1:51 am

Robert Sample wrote:
4) same-named jobs will be initiated one by one, in the order they had been read by SUBMIT command
This isn't how JES2 works. From the manual:
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.
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.

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 come and go, but JCL stays forever.
User avatar
sergeyken
 
Posts: 216
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 5 times
Been thanked: 19 times

Re: JCL which starts other JCL

Postby willy jensen » Tue Oct 12, 2021 2:02 pm

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.
willy jensen
 
Posts: 357
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 49 times


Return to JCL