z/OS MVS JCL Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


IF/THEN/ELSE/ENDIF statement construct

z/OS MVS JCL Reference
SA23-1385-00

This topic describes the IF/THEN, ELSE, and ENDIF statements, collectively called the IF/THEN/ELSE/ENDIF statement construct.

Purpose: Use the IF/THEN/ELSE/ENDIF statement construct to conditionally execute job steps within a job.

The IF statement is always followed by a relational-expression and a THEN clause. Optionally, an ELSE clause can follow the THEN clause. An ENDIF statement always follows the ELSE clause, if present, or the THEN clause.
  • The THEN clause specifies the job steps that the system processes when the evaluation of the relational-expression for the IF statement is a true condition. The system evaluates the relational-expression at execution time.
  • The ELSE clause specifies the job steps that the system processes when the evaluation of the relational-expression for the IF statement is a false condition.
  • The ENDIF statement indicates the end of the IF/THEN/ELSE/ENDIF statement construct, and must be coded for each construct.

You can nest IF/THEN/ELSE/ENDIF statement constructs up to a maximum of 15 levels. The steps that execute in a THEN clause and an ELSE clause can be another IF/THEN/ELSE/ENDIF statement construct.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014