The IF Directive

The IF directive provides a one- or two-way conditional compilation.

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 keywords >>IF, >>ELSE, and >>END-IF must begin on a new line in either area A or area B, and must be specified entirely on that line.
  2. The identifiers text-1 and text-2:
    • Must begin on a new line, and may consist of multiple lines.
    • May be any kind of source lines, including Compiler directives.
    • Can include COPY statements.
    • The phrases of a given IF directive must be specified all in the same library text or all in source text. For purposes of this rule, text-1 and text-2 are not considered phrases of the IF directive. A nested IF directive specified in text-1 or text-2 is considered a new IF directive.

General Rules

  1. text-1 and text-2 are not part of the IF compiler directive line.
  2. The text in the branch that evaluates true is subject to matching and replacing rules of the COPY and REPLACE statements.
  3. If constant-conditional-expression-1 evaluates to TRUE, all the lines of text-1 are included in the resultant text. All lines of text-2 are omitted.
  4. If constant-conditional-expression-1 evaluates to FALSE, all the lines of text-2 are included in the resultant text. All lines of text-1 are omitted.