Previous Topic Next topic Print topic


Specifying a Preprocessor

We provide several alternative methods for specifying a database access preprocessor for your programs and applications.

Project Properties

You can specify a preprocessor as part of your project properties.
OpenESQL
  1. On the SQL tab for your Project Properties, specify OpenESQL as the ESQL Preprocessor.
  2. To specify the type of database access you want, add the DBMAN directive and set its value to ODBC or ADO.
DB2
  1. On the SQL tab for your Project Properties, specify DB2 as the ESQL Preprocessor.
  2. To specify a value for the DB directive, type the name of your DB2 database into the Value field.
    Note: If you leave the value for DB blank, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
COBSQL
On the COBOL tab for your Project Properties, type PREPROCESS(cobsql) into the Additional Directives field.

Command Line

If you compile your applications from the command line, specify your preprocessor as a command-line directive and set options as appropriate. Here we present the minimum with regard to options. For complete information on these compiler directives and their options, see the appropriate Reference topic listed at the end of this topic.

OpenESQL
Use the SQL compiler directive, followed by the DBMAN option to specify the type of database access:

SQL(DBMAN=dbaType)

Where dbaType is ODBC or ADO.

DB2
Use the DB2 compiler directive, followed by the DB option to specify the database name:

DB2(DB=dbName)

Where dbName is the name of your DB2 database.

Note: If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
COBSQL
Use the PREPROCESS compiler directive:
PREPROCESS(cobsql)

Embedded in the Program

You can also specify a preprocessor on the program level by embedding a $SET statement into the program itself. Use this method only when the program requires a preprocessor different from other programs in an application.

OpenESQL
Use the SQL compiler directive, followed by the DBMAN option to specify the type of database access:
$SET SQL(DBMAN=dbaType)

Where dbaType is ODBC or ADO.

DB2
Use the DB2 compiler directive, followed by the DB option to specify the type of database access:
$SET DB2(DB=dbName)

Where dbName is the name of your DB2 database.

Note: If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
COBSQL
Use the PREPROCESS compiler directive:
$SET PREPROCESS(cobsql)
Previous Topic Next topic Print topic