ISO2002ENTMF 

The DEFINE Directive

The DEFINE directive defines or undefines a compilation variable that is used with the conditional compilation directives DEFINE, EVALUATE, and IF. A compilation variable is treated as a symbolic reference to the literal value it currently represents.

Note: In this section, the compiler directing statements DEFINE, EVALUATE, and IF are referenced using the ISO2002 terminology of directives. When referring to the DEFINE Compiler option, it will be explicitly referenced as such.

General Format

Syntax Rules

  1. The DEFINE directive must begin on a new line, in either area A or B, and must be specified entirely on one line.
  2. literal-1 must be one of the following:
    • An alphanumeric literal, specified as a regular alphanumeric literal (for example, 'abcd'), or as a hexadecimal literal (for example, x'F1F2F3'). National literals, DBCS literals, and null-terminated alphanumeric literals (Z literals) are not supported.
    • An integer literal.
    • A Boolean literal of either B'0' or B'1'.
  3. arithmetic-expression-1 must be formed in accordance with the arithmetic expression rules as described in Appendix E - Compile-Time Arithmetic Expressions.
  4. If the DEFINE directive does not specify the OFF or OVERRIDE phrase, one of the following must be true:
    • compilation-variable-name-1 has not previously been declared in the same compilation group.
    • Any previous DEFINE directive that refers to compilation-variable-name-1 must have been specified with the OFF phrase.
    • Any previous DEFINE directive that refers to compilation-variable-name-1 must have specified the same value for it.

General Rules

  1. A DEFINE directive is not processed if it is subject of another conditional compilation and the result is that it is omitted.
  2. In the text that follows a DEFINE directive that defines compilation-variable-name-1 and does not include the OFF phrase, compilation-variable-name-1 can be used in a conditional compilation directive wherever a literal of the category associated with the name is permitted, including in a defined condition and a Boolean condition.
  3. In the text that follows a DEFINE directive that specifies compilation-variable-name-1 with the OFF phrase, compilation-variable-name-1 can be used only in a defined condition, unless compilation-variable-name-1 is redefined in a subsequent DEFINE directive that does not specify the OFF phrase.
  4. When the OVERRIDE phrase is specified, compilation-variable-name-1 is unconditionally set to reference the value of the specified operand.
  5. If the AS PARAMETER phrase is specified, the value referenced by compilation-variable-name-1 is obtained from a DEFINE Compiler option (see DEFINE) for compilation-variable-name-1, if the option is in effect. If no DEFINE Compiler option is in effect for compilation-variable-name-1, compilation-variable-name-1 is not defined.
  6. If arithmetic-expression-1 is specified, it is evaluated according to Appendix E - Compile-Time Arithmetic Expressions, and compilation-variable-name-1 references the resultant value.
  7. If literal-1 is specified, compilation-variable-name-1 references literal-1.