EVALUATE command (COBOL)
The EVALUATE
command provides a shorthand notation
for a series of nested IF
statements. The keywords
cannot be abbreviated.
- constant
- A valid z/OS® Debugger COBOL constant.
- expression
- A valid z/OS Debugger COBOL arithmetic expression.
- reference
- A valid z/OS Debugger COBOL reference.
- condition
- A simple relation condition.
- command
- A valid z/OS Debugger command.
Usage notes
- Only a single subject is supported.
- Consecutive
WHEN
s without associated commands are not supported. THROUGH⁄THRU
ranges can be specified as constants or references.- See Enterprise COBOL for z/OS Language
Reference for
an explanation of the following COBOL keywords:
ANY
FALSE
NOT
OTHER
THROUGH
THRU
TRUE
WHEN
- z/OS Debugger implements
the
EVALUATE
command as a series ofIF
commands. - If the
DATA
option of thePLAYBACK ENABLE
command is in effect for the current compile unit, theEVALUATE
command can be used while you replay recorded statements by using thePLAYBACK
commands. - For optimized COBOL programs, the value of reference cannot refer to 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.
Example
The following example shows an
EVALUATE
command
and the equivalent coding for an IF
command: EVALUATE menu-input
WHEN "0"
CALL init-proc
WHEN "1" THRU "9"
CALL process-proc
WHEN "R"
CALL read-parms
WHEN "X"
CALL cleanup-proc
WHEN OTHER
CALL error-proc
END-EVALUATE;
The equivalent
IF
command: IF (menu-input = "0") THEN
CALL init-proc
ELSE
IF (menu-input >= "1") AND (menu-input <= "9") THEN
CALL process-proc
ELSE
IF (menu-input = "R") THEN
CALL read-parms
ELSE
IF (menu-input = "X") THEN
CALL cleanup-proc
ELSE
CALL error-proc
END-IF;
END-IF;
END-IF;
END-IF;
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)
- Enterprise COBOL for z/OS Language Reference