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
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.
- Check
Enable configuration specific settings and
Use SQL Preprocessor.
- From the
Preprocessor Type drop-down list, select
DB2.
- 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.
- Click
Apply.
Alternatively, you can enter the preprocessor specification and options as additional directives:
- 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.
- 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])]
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.