The Dynamic Bind Utility enables you to bind dynamically programs that get -805 or -818 SQL errors.
A good example of how you can take advantage of this utility is if your organization has a number of common SQL routines that they share but they use these routines against multiple databases. Someone within the organization, usually the DBA, would have to bind these common modules against each database for them to be used. Another option would be to compile each of these routines against each database. If someone changed one of the common routines, the bind/compile process would have to be repeated for each database!
Host Compatibility Option offers a third option. When you compile an SQL routine, Host Compatibility Option passes additional information to the MFHCOCDS routine when an SQL error occurs. If a -805 or -818 error occurs, Host Compatibility Option tries to find the bind file associated with the routine in error and then bind the package against the database to which the program is currently connected. A message is then displayed reporting whether the bind was successful. The original SQL error is returned to your program so that you need to restart the program or, if you are animating the program, re-execute the SQL statement that originally failed.
To implement this feature, you need to:
The BIND directive creates a bind file for each common routine. When the -805 or -818 SQL error occurs, Host Compatibility Option looks for the bind file using the following search sequence:
To take advantage of the dynamic bind utility, set the HCO_AUTOREBIND environment variable as follows:
You can still use the HCO BIND tool to quickly re-bind all applications.