JCL Condition
Below is the sample JCL to execute the a step to generate the different condition based on input. Use this sample JCL step to create a multi step JCL to trigger/skip the steps based on conditions.
note
Replace <Your ID>
with your training id and <YOUR REXX EXEC>
with your previously create REXX EXEC dataset which have RETRC
member.
//<YOUR ID>E JOB ,TYPRUN=HOLD,NOTIFY=&SYSUID
//COMBINE EXEC PGM=IRXJCL,PARM='RETRC 2'
//SYSEXEC DD DSN=<YOUR REXX EXEC>,DISP=SHR
//SYSTSIN DD DUMMY
//SYSTSPRT DD SYSOUT=*
Pre requiste before you can execute below JCL's
Create a dataset with RECFM=FB,LRECL=80,BLKSIZE
to store the below REXX with name RETRC
.
/* REXX RETURN EXPECTED RC */
PARSE ARG RETCD
SAY RETCD
IF DATATYPE(RETCD) <> 'NUM' THEN RETCD = 0
EXIT RETCD
Scenario 1
Create a Job with 5 Steps each with Following Specification
- STEP1
- If Runs it should Return with RC = 8
- STEP2
- If Runs it should Return with RC = 6
- It should Run only if STEP1 RC = 6
- STEP3
- If Runs it should Return with RC = 4
- It should Run only if STEP2 RC = 8
- STEP4
- If Runs it should Return with RC = 2
- It should Run only If STEP1 RC = 8
- STEP5
- If Runs it should Return with RC = 16
- It Should Run only If STEP4 RC is Between 4 to 8
Scenario 2
TBA
Scenario 3
TBA