Previous Topic Next topic Print topic


Setting Compiler Directives on Individual Files

You can set properties and Compiler directives that only affect individual files during compilation.

Files in your project inherit the properties set on project level. You can specify individual file properties and these override the project-wide and build configuration settings. To set file properties:

  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 field 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.

The following only applies to native COBOL. When compiling single COBOL programs, such that are opened in the IDE without a project, the IDE uses the Compiler directives specified on the Single File Compile properties page in Window > Preferences > Micro Focus > COBOL.

To view or modify the Compiler directives for compiling single files:

  1. Open a COBOL program in the editor using File > Open File.
  2. Right-click in the editor and click Compiler Options.

    The default Compiler options for single files are:

    nognt int() anim

    For example, to specify the locations of any copybooks used in the single 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.
Previous Topic Next topic Print topic