skip to main content

Compiler and Runtime : Compiler : Compiler Directives : EVALUATE Directive

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:
1.
ConstantName is a constant defined in the configuration file as iscobol.compiler.const.ConstantName or using the DEFINE Directive compiler directive.
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
           display message "debug level: 1"
           display message "debug level: 2"

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left