THEN and ELSE clauses
A THEN clause consists of the JCL statements between the IF/THEN statement and, if specified, its matching ELSE statement; otherwise, its matching ENDIF statement. If you do not specify any statements, it is a null THEN clause.
An ELSE clause consists of the JCL statements between the ELSE statement and its matching ENDIF statement. If you do not specify any statements, it is a null ELSE clause.
In an IF/THEN/ELSE/ENDIF statement construct, the THEN clause or the ELSE clause must contain at least one EXEC statement to identify a job step.
The system executes the following statements conditionally, in
either the THEN clause or the ELSE clause of an IF/THEN/ELSE/ENDIF
statement construct. Execution of the statement depends on the evaluation
of the relational-expression at execution time:
- Nested IF/THEN/ELSE/ENDIF statement constructs
- EXEC statements
- DD (including DD * and DD DATA) statements
- STEPLIB DD statements
- SYSABEND, SYSMDUMP, and SYSUDUMP DD statements
- SYSCHK (step level) and SYSCKEOV DD statements
- SYSIN DD statements
- OUTPUT JCL statements
- CNTL and ENDCNTL statements
Do not place the following statements in a THEN or ELSE clause:
- JOB statement
- JCLLIB statement
- JOBLIB statement
- SYSCHK (job level) statement
- XMIT JCL statement
The system processes the following statements regardless of the
logic of the IF/THEN/ELSE/ENDIF statement construct. They can be
placed in a THEN or ELSE clause, but they are not executed conditionally.
- PROC and PEND statements
- JES2 and JES3 statements and commands
- JCL command statements
- Comment (//*) statements
- INCLUDE statements
- Delimiter (/*) statements
- Null statements
- SET statements