The DO block can optionally include IF/ELSE/ENDIF blocks. The block permits conditionally performing DO commands. DO IF, DO ELSE, and DO ENDIF statements provide Control-M JCL Verify with Boolean "IF" logic capability. These statements permit branching based on different criteria. The examples at the end of this section demonstrate combination of these statements.
Type IF in the DO field and press Enter. The word DO is replaced by the word IF on the screen. The same will occur when specifying ELSE and ENDIF in the DO fields.
The following figure shows the basic format of the IF/ ELSE/ ENDIF control statements.
Fig.JV.3.23 IF/ ELSE/ ENDIF Statements Format
IF conditional-expresssion1 [{AND|OR} conditional-expression2]
DO action
DO action
.
.
.
.
DO action
ELSE
DO action
DO action
.
.
.
.
ENDIF
The IF conditional expression has the following format:
IF operand operator operand
Valid logical operators are shown in the following table. For numeric comparisons, use the logical operators with the "#" symbol.
Tab.JV.3.19 Logical Operators for IF Statement
Operator |
Definition |
---|---|
EQ |
is equal to |
NE |
is not equal to |
GT |
is greater than |
GE |
is greater than or equal to |
LT |
is less than |
LE |
is less than or equal to |
Valid Boolean operators are shown in the following table.
Tab.JV.3.19a Boolean Operators for IF Statement
Operator |
Definition |
---|---|
AND |
both expressions must be true |
OR |
either expression must be true |
Operators that end with the pound sign (#) are used for numerical comparisons, as opposed to string comparisons.
An operand can be any character string. It can also be composed of AutoEdit symbols. In such cases, it is resolved into a character string before the conditional expression is analyzed at execution time.
Whenever non-numeric comparison operators are specified, operands are compared as character strings from left to right. For example, in the expression
IF 91 GT 1000
91 is greater than 1000 (because 9 is greater than 1).
An operand cannot be resolved into nulls (as in CLISTs). If it is possible that an operand will resolve into nulls, place a character before the first and second operands.
In the following example, the character B is placed before the two operands:
IF B%%A GT B%%C
An IF expression must be terminated with an ENDIF statement. The ELSE statement is optional.
Parent Topic |