EVALUATE Directive
The EVALUATE directive checks the value of a constant to determine the inclusion of lines of source code.
>> EVALUATE ConstantName { >> WHEN String Statement-1 } ... [ >> WHEN OTHER Statement-2 ] >> END-EVALUATE |
Syntax:
2. String is a text string delimited by quotes.
3. Statement-1 and Statement-2 are lines of COBOL code.
General rules:
1. When String matches the value of ConstantName, the lines in Statement-1 are included.
2. When no match is found, the lines in Statement-2 are included.
Example
Show a message only if the DEBUG constant is set either to 1 or 2:
>>EVALUATE DEBUG >>WHEN 1 display message "debug level: 1" >>WHEN 2 display message "debug level: 2" >>END-EVALUATE ... |