The Order in which Compiler Directives are Processed

Compiler directives can be specified using more than one method. During compilation, they are processed in a particular order according to the method in which they have been specified.

The Compiler processes directives specified on the command line from left to right. If a directive appears more than once, the Compiler uses the setting that it processed last for that directive.

The Compiler processes directives in the following order:

  1. Directives contained within the system-wide directives file cobol.dir.
    Note: If NOCOBOLDIR is set anywhere, the directives in this file are not processed.
  2. Directives contained within the common directives file, directives.mf.
  3. On the command line, system default directives contained in cob options in the file $COBDIR/etc/cobopt .
  4. On the command line, user default directives contained in cob options in the environment variable COBOPT .
  5. Directives set via the $SET statement within the source code.

    In addition, you can set directives in a user directives file, which you specify with the USE directive; these are processed when they are encountered.

The above order means that, for example, a directive set using a $SET statement would override the setting for that directive that has been set in the project properties.