The ENDIF statement marks the end of an IF/THEN/ELSE conditional block in JCL. It is required to terminate every IF statement and indicates where normal sequential execution of JCL statements resumes.
12345//[name] IF (condition) THEN // statements to be executed if condition is true [// ELSE // statements to be executed if condition is false] //[name] ENDIF
1234// IF RC = 0 THEN //STEP2 EXEC PGM=GOODRUN // ENDIF //STEP3 EXEC PGM=NEXTSTEP
123456// IF STEP1.RC < 8 THEN //STEP2 EXEC PGM=NORMALPROC // ELSE //STEP2 EXEC PGM=ERRORPROC // ENDIF //STEP3 EXEC PGM=CLEANUP
12345678// IF &SYSDAY = 'FRIDAY' THEN // IF &SYSTIME > '17:00' THEN // SET BACKUP='FULL' // ELSE // SET BACKUP='INCR' // ENDIF /* End of inner IF */ //STEP1 EXEC PGM=BACKUP,PARM='&BACKUP' // ENDIF /* End of outer IF */