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

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

Enterprise Developer プロジェクト
  1. Open your project properties and expand Micro Focus > Project Settings > COBOL > SQL Preprocessor.
    注: 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.
  2. Check Enable configuration specific settings and Use SQL Preprocessor.
  3. From the Preprocessor Type drop-down list, select HCO for DB2 LUW.
  4. Type the name of your database into the Value field of the DB setting.
    注: If you leave the value for DB blank, the compiler uses the database specified by the value of the DB2DBDFT environment variable.
  5. Click Apply.

Alternatively, you can enter the preprocessor specification and options as additional directives:

  1. Open your project properties and expand Micro Focus > Project Settings > COBOL.
    注: 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.
  2. In the Additional directives value cell, click and in the Additional directives dialog box, type:
    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 プリプロセッサ指令を 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])] (Windows)

Or:

DB2[(DB==dbName [DB2dirOpts])] (UNIX)

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 環境変数の値として指定されたデータベースを使用します。