IF command (COBOL)
The IF command lets you conditionally perform
a command. You can optionally specify an ELSE clause
on the IF command. If the test expression evaluates
to false and an ELSE clause exists, the command associated
with the ELSE clause is performed. The keywords
cannot be abbreviated.
condition- A simple relation condition with the following form:
Item-1 operator Item-2. Item-1 and Item-2 can be a data-item or a literal. The operator can be one of the following operations:><=NOT =>=<=NOT <NOT >
command- A valid z/OS® Debugger command.
When IF commands are nested and ELSE clauses
are present, a given ELSE or END-IF is
associated with the closest preceding IF clause within
the same block.
Unlike COBOL, z/OS Debugger requires
terminating punctuation (;) after commands. The END-IF keyword
is required.
Usage notes
- An
ELSEclause should always be included if theIFclause causes z/OS Debugger to get more input (for example, anIFcontainingUSEor other commands that cause z/OS Debugger to be restarted because anAT-condition occurs). - The COBOL
NEXT SENTENCEphrase is not supported. - Comparison combinations with windowed date fields are not supported.
- Comparisons between expanded date fields with different DATE FORMAT clauses are not supported.
- If the
DATAoption of thePLAYBACK ENABLEcommand is in effect, theIFcommand can be used while you replay recorded statements by using thePLAYBACKcommands. - For optimized COBOL programs, the
IFclause cannot reference any variables discarded by the optimizer. - If a COBOL variable is defined as National and it is an operand in a relation condition with an alphabetic, alphanumeric operand, or National numeric, the operand that is not National is converted to Unicode before that comparison is done, except for Group items. See Enterprise COBOL for z/OS Language Reference for more information about using COBOL variables in conditional expressions.
Refer to the following topics for more information related to the material discussed in this topic.
- Related references
- Allowable comparisons for the IF command (COBOL)
