DB2 ECM プリプロセッサとコンパイラ指令オプションの設定

DB2 ECM プリプロセッサとそのコンパイラ指令オプションを指定するにはいくつかの方法があります。

Enterprise Developer プロジェクト
  1. Open your project properties and click the SQL tab.
  2. From the ESQL Preprocessor drop-down list, select HCO for DB2 LUW.
  3. 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.
    注: If you leave the value for DB blank, the compiler uses the database specified by the value of the DB2DBDFT environment variable.
指令ファイル
DB2 ECM プリプロセッサ指令を cobol.dir というシステム全体の指令ファイルや、ユーザー指令ファイル、またはそれらの両方に含めることができます。詳細は、「システム指令ファイル cobol.dir」および「ユーザー指令ファイル」を参照してください。
コマンド ライン
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.

注: If you do not specify the DB option, the compiler uses the database specified as the value of the DB2DBDFT environment variable.
プログラムへの埋め込み
DB2 ECM プリプロセッサとコンパイラの指令オプションは、$SET 文をプログラム (の最初の行) に埋め込んでプログラム レベルで指定することもできます。
$SET DB2[(DB=dbName [DB2dirOpts])]

dbName は DB2 データベースの名前であり、DB2dirOpts は 1 つ以上の追加指令オプションです。

重要:
  • この方法は、アプリケーション内の他のプログラムとは異なるプリプロセッサをプログラムで使用する場合にのみ使用します。
  • DB オプションを指定しない場合、コンパイラは DB2DBDFT 環境変数の値として指定されたデータベースを使用します。