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. For details, see the BIND DB2 compiler directive option topic.

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. For details, see the BINDDIR DB2 compiler directive option topic.

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.