Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
IF statement z/OS DFSMSdfp Storage Administration SC23-6860-01 |
|
Use the IF statement for conditional statement execution. You must always follow an IF statement with a THEN clause. The THEN clause can be a single statement or a DO-END group of statements. You can optionally follow a THEN clause with an ELSE clause. If you specify the ELSE clause, you must follow it with either a single statement or a DO-END group of statements. If you want to specify the ELSE clause but do not want to follow it with an executable statement, follow it with an empty DO-END pair. If the result of the IF statement comparison is true, the THEN clause is executed. If the result is false, the ELSE clause is executed. If you omit the ELSE, processing continues with the next sequential statement after the THEN clause. IF relational expression THEN clause ELSE clause
For information on what constitutes a valid relational expression, refer to Comparison rules. Figure 1 shows two examples of IF statements:
Figure 1. Examples of IF Statements
The statement on the left sets &STORCLAS equal to ONE or TWO, depending on the value of &DSOWNER The statement on the right sets &STORCLAS equal to TWO, regardless of the value of &DSOWNER If &DSOWNER equals 'BILL', then &STORCLAS is set to 'ONE'. The ELSE clause is skipped, and execution falls to the next statement, which changes &STORCLAS to 'TWO'. If &DSOWNER does not equal 'BILL', execution falls to the ELSE, which results in no assignment to &STORCLAS Then execution proceeds to the next sequential statement, which sets &STORCLAS to 'TWO'. |
Copyright IBM Corporation 1990, 2014
|