You can use directives to control the way the Compiler behaves: what output it produces, what code is compiled and how the compiled code behaves when it runs. For normal operation you need only a few directives. Most of the time, you use the default values.
Note that setting some directives affects the default setting of other directives. For example, setting one directive might automatically unset another directive, and some directive settings are mutually exclusive.
You can set directives directly, by setting them for a project in the IDE, or if you are using the command line tools, by setting them on the command line, or as part of a response to a prompt. You can set directives by using the following:
- To set directives for a project . If you set the compiler directives for a project in the IDE, the directives are saved with the project, so that they are used by default next time you compile a program.
- System-wide directives file. Use this file if you want to permanently override the default value of a directive.
- $SET Statements in the Source Code. Use these if your program is affected by particular circumstances, such as needing a specific currency symbol that none of the other programs in an applicaton needs
- User directives file. Use this file you have a set of directives that you always want to use together.
- The DIALECT Compiler directive. Use this directive if you want to emulate a specific COBOL dialect. With Net Express you can emulate the ANS85 and ISO2002 COBOL dialects.
- Compiling from the command line. You can set directives as options to the cobol command.
- To set directive for a single file. You can set different directives for an individual file, so that these override the project directives for this one file.
The Compiler processes the directives in the following order, and if a directive is specified more than once, the Compiler uses the last setting:
- Directives set in project properties
- System-wide directives file
- $SET statements in the source code
- User directives file