Conditional Compilation Options

The compiler supports conditional compilation through the use of special constructs in the COBOL source file and by accepting command-line arguments that turn on compiler directives and set constants to values. See Conditional Compilation for a description of the COBOL constructs.

The / compiler option is used to turn on directives and specify constants.

The two forms to this option are:

  1. Directive setting mode
    /[NO]directive

    This option is equivalent to having the following line in your COBOL source from the very beginning of the compilation:

    $SET [NO]directive

    By adding this compile switch, you turn on the directive (or off, if the directive is preceded by NO). This directive can now be tested with a Format 3 $IF statement, which can signal the compiler to either compile or skip the next lines of code.

    See Conditional Compilation for details on the $IF and $SET statements.

    If compiling for HP compatibility (-Cp) the -$IF and -$SET directives are supported.

  2. Value setting mode
    /CONSTANT name=value

    This option is equivalent to having a level-78 item defined in your COBOL source. If value is composed solely of numeric digits, the constant is considered numeric; otherwise, it is considered a string literal. Name can now be tested with a Format 1 $IF statement.

Note: The -Cg compiler option turns off the conditional compiling features. Conditional compiling statements begin with the $ sign. In prior versions, lines of code that began with the $ sign were treated as comments. Some COBOL programs use a type of conditional compilation which may fail to compile as a result. Turning off conditional compiling should rectify these situations.

Other Options

$SET ADDSYN "word1" = "word2"

Make the user-defined word word2 a synonym for reserved word word1.

$SET MAKESYN "word1" = "word2"

Make the reserved word word2 a synonym for reserved word word1. This is equivalent to the compiler option -Rn word1 word2

$SET DEFAULTBYTE "num"

num must be a numeric value between 0 and 255. The default fill byte is set to the value given. This is equivalent to the -Dv=num compiler option.

$SET SPZERO

Equivalent to the -Zz compiler option.

$SET INTLEVEL "nn"

Equivalent to the -Znn compiler option.

$SET CALLFH "program"

This currently does nothing, but is included for completeness.

$SET FCDREG

This currently does nothing, but is included for completeness.

$SET INITCALL "program"

This currently does nothing, but is included for completeness.