Setting Compiler directives on folders or individual files

Files and folders in your project inherit their properties from those set at the project level, and the build configuration level. For native COBOL projects, you can specify directives on individual folders or files that override any set at the project level and build configuration level .

Folders, and files that are part of a project

To set directives on folders orindividual files in a project:

Note: Setting directives at the folder or file level is only applicable to native COBOL projects.
  1. In the COBOL Explorer view, right-click the folder or file to update and select Properties.

    The Properties for folder/program-name dialog box is displayed.

  2. Click COBOL.

    The properties are displayed in the right-hand pane.

  3. Do one or more of the following:
    • To set COBOL properties and directives:
      1. Check Enable file specific settings.
      2. Check Override settings from a higher level (instead of merging) to replace all directives inherited from a higher level with directives set here.
      3. Set properties using the appropriate fields and controls.
      4. In the Additional directives value cell, click Ellipsis button and type the directives to be used when compiling this file in the Additional directives dialog box. 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).

      5. 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. Click Apply and Close.
  5. To specify whether or not to compile the contents of the folder or the individual file, right-click it 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.
Tip: To view the complete list of directives applied to a file (that is, those set in the project settings, the active build configuration, the folder settings, and file settings), in the Properties for program-name dialog box, select COBOL > Directives. Alternatively, you can display a summary in the editor; see tip below.

Standalone files

Note: Setting directives for standalone files is only applicable to native COBOL projects.

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 Apply and Close.
Tip: To display all of the directives in effect for a file, click Display a Compiler directives summary icon (Display a compiler directives summary inside the COBOL editor). This option toggles on/off a 2-line summary at the bottom of the editor, detailing all directives currently set for the file. If this option is not displayed, click Window > Preferences > COBOL > Editor, and then select Show compiler directives summary in editor. You can also set the preferred background color for this summary by selecting the current background color, shown in this section, and selecting a new one from the palette.