Previous Topic Next topic Print topic


Setting the DB2 ECM Preprocessor and Compiler Directive Options

We provide several options that enable you to specify the DB2 ECM preprocessor and its applicable compiler directive options:

In your Enterprise Developer Project
  1. Open your project properties and expand Micro Focus > Project Settings > COBOL > SQL Preprocessor.
    Note: You can also set the preprocessor under Micro Focus > Build Configurations > COBOL > SQL Preprocessor. If you do this, the setting applies only when the build configuration is active, and the preprocessor is not set to something else in the Project Settings or on the program level.
  2. Check Enable configuration specific settings and Use SQL Preprocessor.
  3. From the Preprocessor Type drop-down list, select HCO for DB2 LUW.
  4. Type the name of your database into the Value field of the DB setting.
    Note: If you leave the value for DB blank, the compiler uses the database specified by the value of the DB2DBDFT environment variable.
  5. Click Apply.

Alternatively, you can enter the preprocessor specification and options as additional directives:

  1. Open your project properties and expand Micro Focus > Project Settings > COBOL.
    Note: You can also set the preprocessor under Micro Focus > Build Configurations > COBOL. If you do this, the setting applies only when the build configuration is active, and the preprocessor is not set to something else in the Project Settings or on the program level.
  2. Click in the Additional directives field and type:
    DB2[(DB=dbName [DB2dirOpts])]

    Where dbName is the name of your DB2 database, and DB2dirOpts is one or more additional directive options.

    Note: If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
In a Directives File
You can include DB2 ECM preprocessor directives in the cobol.dir system-wide directives file, a user directives file, or both. See System-wide Directives File, cobol.dir and User Directives File for details.
On the Command Line
Use the DB2 compiler directive, followed by the DB option to specify the database name, followed by additional options:

DB2[(DB=dbName [DB2dirOpts])] (Windows)

Or:

DB2[(DB==dbName [DB2dirOpts])] (UNIX)

Where dbName is the name of your DB2 database, and DB2dirOpts is one or more additional directive options.

Note: If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
Embedded in the Program
You can also specify the DB2 ECM preprocessor and compiler directive options on the program level by embedding a $SET statement into the program itself on the first line of the program:
$SET DB2[(DB=dbName [DB2dirOpts])]

Where dbName is the name of your DB2 database, and DB2dirOpts is one or more additional directive options.

Important:
  • Use this method only when the program requires a preprocessor different from other programs in an application.
  • If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
Previous Topic Next topic Print topic