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 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])]

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.