Conditional Compilation

Conditional compilation provides a mechanism for selectively compiling part or all of the COBOL source. Conditional compilation is controlled by $IF, $ELSE, and $END constructs, which behave in a similar way to the COBOL IF construct. Conditional compilation also supplies the $DISPLAY Statement, which can be used to display a message during compilation or include a version number in the object file. The $SET statement can be used to define compiler directives for use in $IF statements.

Note: The compiler has special conditional compilation options that turn on compiler directives and set constants to values. There is also a compiler option (-Cg) that turns of conditional compiling features. See the ACUCOBOL-GT Users Guide, Conditional Compilation Options for details.

Syntax Rules

  1. Conditional compilation statements are indicated by a dollar sign ($) in the indicator area of the source line followed by one of the key words IF, DISPLAY, ELSE, END, and SET.
  2. Conditional compilation should not be used to split a COBOL character string; that is, continuation lines should not be split by conditional compilation controls.