Previous Topic Next topic Print topic


Binding

By default, using the database specified by the DB compiler directive option, the DB2 ECM preprocessor automatically binds your program during the compilation process, creating and storing in your DB2 database a DB2 package required for successful execution.

However, depending on your environment, this straight-forward, default behavior might not match your requirements. For instance, you might want to create DBRMs (.bnd files) during compilation, and bind the DBRMs later using the DB2 LUW BIND command against your DB2 LUW databases. For this and other related scenarios, we provide several DBRM options.

DBRM Options

We provide one option that enables you to specify an alternative name for the created DBRM file, and three options that enable you to redirect DBRM files to an alternative directory. If you specify more than one output option, the DB2 ECM uses the option that is determined to take precedence.

BIND (or BINDFILE) and BINDDIR compiler directive options
BIND (or BINDFILE)
In addition to instructing the DB2 ECM to create a DBRM file, you can also use BIND to specify an alternative filename for the DBRM file. The default DBRM filename is programname.bnd.

BIND also enables you to redirect the created DBRM file to an alternative directory. The default is the current directory unless you have also used one or both of the BINDDIR and HCOBND options. When you specify a path using BIND, it takes precedence over that specified by all other output options, if set.

Note: When compiling a program with the ACCESS compiler directive option (default), the DBRM is bound into the connected database, where it creates the SQL package required for execution. When compiling with NOACCESS, no binding takes place.

You can set BIND on the command line or in your project properties. For details, see the BIND DB2 compiler directive option topic and the Setting BIND and BINDDIR in your project section below.

BINDDIR
Use BINDDIR to specify an alternative output directory for the created DBRM file. The path specified by BINDDIR takes priority over that specified by the HCOBND environment variable, but is overridden if a path is specified by BIND (or BINDFILE).

You can set BINDDIR on the command line or in your project properties. For details, see the BINDDIR DB2 compiler directive option topic and the Setting BIND and BINDDIR in your project section below.

Setting BIND and BINDDIR in your project
If you want to use BIND or BINDDIR when compiling from your Enterprise Developer, set one or both of these directives in your project properties on the SQL Preprocessor page. On the Setting grid, you can enter a specific directory for one or both. Alternatively, to set either to your defined build output directory, use the drop-down list associated with the directive to change its setting to <Enabled>. This instructs the IDE to automatically substitute the build directory when it generates the directive.
Note: When you clean a project, Enterprise Developer deletes all files in the build directory, including .bnd files.
HCOBND environment variable
Attention: This option is deprecated, and provided for backward compatibility only.

Set the HCOBND environment variable to specify an alternative output directory for created DBRM files. This option has the lowest priority, and is used only when no alternative path is specified by either the BIND or the BINDDIR compiler directive options.

See HCOBIND environment variable for details.

Previous Topic Next topic Print topic