$SET statement can be used to define compiler directives for use in
IF Statement. The directives set with this method have no value, they are only set. The
$SET statement can also be used to set values for COBOL variables in the same way as a level 78 data item.
There are two formats for the $SET statement.
$SET CONSTANT identifier value
- The whole statement must appear on a single line.
- The sole effect of the Format 1 $SET statement is to set a directive name in the compilation unit. Alternatively, you can
-/ (forward slash) compiler option to set a directive name. If a later Format 3 $IF statement is encountered, this statement
true if the compiler-directive set by
$SET matches the directive-setting in the
$IF statement. Preceding the compiler directive with NO turns off the setting. See Conditional Compilation Options in the ACUCOBOL-GT User’s Guidefor more information.
- identifier must be a valid COBOL identifier.
- value is any valid value for a COBOL identifier.
value is surrounded by single (') or double (") quotes, it is a string literal.
identifier can be used anywhere a string literal can be used.
value is surrounded by parentheses (()), it is a numeric literal.
- identifier can be used anywhere a numeric literal can be used.
value is neither quoted nor surrounded by parentheses, it will be
considered a numeric literal if all of the characters in the value are digits. Otherwise it is considered a string literal.
- A format 2
$SET statement is equivalent to the following line:
77 identifier VALUE value.
with the exception that the level "77" line doesn't allow numeric values to be surrounded with parentheses.