We provide several options that enable you to specify the DB2 ECM preprocessor and its applicable compiler directive options:
- In your
Visual COBOL Project
-
- Open your project properties and
click the
SQL tab.
- From the
ESQL Preprocessor drop-down list, select
DB2.
- Click
Add and choose
DB from the list of directives, and click
OK. Type the name of your database into the
Value field of the directive details.
Note: If you leave the value for DB blank, the compiler uses the database specified by 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])]
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.