Submit another JCL as a step from main JCL based on RC of the previous step {via Internal Reader}

3.6k Views Asked by At

I have a requirement wherein I have to submit 10 JCL's. Every JCL is coded to give MAXXCC=0 when completed good.

I want to call all the JCL's from a main JCL so that I don't have to submit all the JCL's manually.

If this is not possible through internal reader, please suggest any other workaround.

THIS IS HOW I CODED THEM CURRENTLY:

//*************************************************************
//* STEP 1: Run job 2
//*************************************************************
//*                                                            
//STEP02   EXEC PGM=IEBGENER                                   
//SYSUT1   DD   DISP=SHR,DSN=HLQ.MYPDS(JCL2)   
//SYSUT2   DD   SYSOUT=(,INTRDR)                               
//SYSPRINT DD   SYSOUT=*                                       
//SYSIN    DD   DUMMY                                          
//*                                                            
//*************************************************************
//* STEP 3: Run job 3
//*************************************************************
//*                                                            
//STEP03   EXEC PGM=IEBGENER,COND=(0,EQ,STEP0)                                   
//SYSUT1   DD   DISP=SHR,DSN=HLQ.MYPDS(JCL3)   
//SYSUT2   DD   SYSOUT=(,INTRDR)                               
//SYSPRINT DD   SYSOUT=*                                       
//SYSIN    DD   DUMMY                                          
//*                                                    
1

There are 1 best solutions below

3
On BEST ANSWER

Scheduling System

As other suggested use the scheduling system, I would think all mainframe systems would have some sort of scheduler. Running Jobs in sequence is there bread and butter of Scheduling systems.

You do need to learn about scheduling systems and the sooner the better. Ask at work !!!

Other options do exist

JCL Chaining - Each job submit the next job

Basically you can have each job submit the next job e.g.

Job 1:

// --- Job 1 JCL
//*
// --- JCL to submit Job 2

Job 2:

// --- Job 2 JCL
//*
// --- JCL to submit Job 3

If you use this method I would create a JCL proc (say SUBNEXT)

// --- Job 1 JCL
//*
//   EXEC SUBNEXT,NEXT=JOB2

You can use the JCLLIB statement to use your own PROCLIB (PDS where you store SUBNEXT). To use JCLLIB:

//MYJOB1   JOB     ...
//MYLIBS1  JCLLIB  ORDER=MY.PROCS.JCL

Jes 3 scheduling

If using Jes-3; There is in-built job control. Only use this option if you know what you are doing other wise the operation staff will get upset. Basically make sure you use the flush option