Setting Compiler Directives on Individual Files

Files in your project inherit the properties set on the project level. You can specify properties on individual files that differ from and override the project's and the build configuration properties.

Files that are part of a project

To set properties on individual files in a project:

  1. In the COBOL Explorer view, right-click the file you want to change.
  2. Click Properties > COBOL.
  3. Do one or more of the following:
    • To set COBOL properties and directives:
      • Check Enable file specific settings.
      • Set properties using the appropriate fields and controls.
      • Click in the Additional directives value cell and type the directives to be used when compiling this file. Separate each directive with a space.

        To guarantee that a directive set in a project or build configuration does not apply to a particular file, you must explicitly specify NO<DIRECTIVE> (for example, NOLOCALSOURCEFORMAT or NODATAMAP).

      • Click OK.
    • To set a preprocessor and SQL compiler directive options:
      1. Expand COBOL and click SQL Settings.
      2. Check Enable file specific settings and EXEC SQL.
      3. From the Preprocessor Type drop-down list, select the preprocessor you want to use.
      4. On the Directives grid, complete the Value field for each directive you want to set; then click Apply.

        The SQL compiler directives you have selected appear in the SQL Directives text box.

      5. Click OK.
  4. To specify whether or not to compile the file, right-click the file and click Build Action > Compile or Build Action > Ignore as required. By default, files with a .cbl extension are compiled and copybooks (.cpy) are not.

Standalone files

The following functionality is only supported for native COBOL.

Standalone files are files that are opened in the IDE without a project.

When compiling a standalone COBOL program, the IDE first searches for the program's symbols file (.idy) which includes the Compiler directives to use. It searches for the file either in the location of the COBOL program or in any directory specified in Window > Preferences > Micro Focus > COBOL > Standalone Files > Program Symbols (.IDY). If no program symbols file is found, the IDE uses the Compiler directives specified on the Compile properties page in Window > Preferences > Micro Focus > COBOL > Standalone Files.

To specify Compiler directives for compiling standalone files in the IDE:

  1. Open a COBOL program in the editor using File > Open File.
  2. Click Window > Preferences > Micro Focus > COBOL > Standalone Files > Compile and ensure the Compiler directives to use with standalone files are as required. The default directives are as follows:
    • nognt int() anim for the 32-bit Eclipse.
    • nognt int() anim P64 for the 64-bit Eclipse.

    For example, to specify the locations of any copybooks used in the standalone file when the copybooks are not in the same location, set the COPYPATH Compiler directive, COPYPATH(<location1>;<location2>;...).

    If you have changed these directives, to reset them to the default values, click Restore Defaults.

  3. Ensure the Compiler directives are as required, then click OK.