ISO2002 IF Directive

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

General Format
>>IF constant-conditional-expression-1 [source-text-1] [ >>ELSE [source-text-2] ] >>END-IF
Syntax Rules
  1. Each pair of contiguous COBOL characters >> and the succeeding compiler-directive words and operands up to, but not including, source-text-1 and source-text-2 must be specified on a new line and be specified entirely on that line. The first text-word of source-text-1 and the first text-word of source-text-2 must each begin on a new line.
  2. Source-text-1 and source-text-2 may be any kind of source text, including compiler directives. Source-text-1 and source-text-2 may span multiple lines.
General Rules
  1. The IF directive is processed during the processing of COPY and REPLACE statements.
  2. If constant-conditional-expression-1 evaluates to TRUE, then source-text-1 is compiled as part of the source text, and source-text-2 is ignored.
  3. If constant-conditional-expression-1 evaluates to FALSE, then source-text-1 is ignored and source-text-2, if specified, is compiled as part of the source text.