Package recreation using the BIND command and an existing bind file

Binding is the process that creates the package the database manager needs to access the database when the application is executed.

By default the PRECOMPILE command creates a package. Binding is done implicitly at precompile time unless the BINDFILE command parameter is specified. The PACKAGE command parameter allows you to specify a package name for the package created at precompile time.

A typical example of using the BIND command follows. To bind a bind file named filename.bnd to the database, you can issue the following command:

   BIND filename.bnd

One package is created for each separately precompiled source code module. If an application has five source files, of which three require precompilation, three packages or bind files are created. By default, each package is given a name that is the same as the name of the source module from which the .bnd file originated, but truncated to 8 characters. To explicitly specify a different package name, you must use the PACKAGE USING parameter on the PREP command. The version of a package is given by the VERSION precompile parameter and defaults to the empty string. If the name and schema of this newly created package is the same as a package that currently exists in the target database, but the version identifier differs, a new package is created and the previous package still remains. However if a package exists that matches the name, schema and the version of the package being bound, then that package is dropped and replaced with the new package being bound (specifying ACTION ADD on the bind would prevent that and an error (SQL0719) would be returned instead).