DB2 10.5 for Linux, UNIX, and Windows

Strings for the GENERIC option on the BIND command

Description

The command line process command BIND contains the GENERIC parameter. The GENERIC parameter specifies a string that contains any option-value pairs. Each option and value must be separated by one or more blank spaces. The syntax for this string is displayed as follows:

GENERC 'option1 value1 option2 value2 '
The option-values available for the Linux, Unix, and Windows (LUW) platforms are the following strings:
  • HV_EXPANSION_FACTOR <1|2|3|4>
  • STATICASDYNAMIC [YES|NO]

HV_EXPANSION_FACTOR <1|2|3|4>

This option applies a multiplier to CHAR and VARCHAR host variables. It is also expand character host variable lengths within database server to accomdate code page conversion expansion in unequal codepage environment.

You should use this string in order to resolve -302 errors occurring in static SQL applications running in unequal codepage environments even after table definitions increased to accommodate expansion. This is because static SQL by default uses the defined length of the host variable provided by the client during BIND to size the equivalent database server memory location for the variable.

Assume there's a 819 codepage application with string "niño". This requires a 4 byte character string variable in the application. However in unicode UTF-8 the string requires 5 bytes as ñ takes 2 bytes to represent. So if you had an application running codepage 819 connecting to a unicode (utf-8) database, issue
bind myapp GENERIC HV_EXPANSION_FACTOR 2

To force the database to allocate 2 times the defined application length for the server representation of the variable. So in this example the 4 byte variable becomes 8 bytes in the database server. This enables the string nio on expansion to 5 bytes in UTF-8, so it still fits in the memory available to the variable

STATICASDYNAMIC [YES|NO]

You can set the DB2® database manager to store all statements in the catalogs and marks them as incremental bind. To achieve this setting, the STATICASDYNAMIC YES string must be set for the GENERIC BIND command option.

At run time, when the package is first loaded, the database manager uses the current session environment (rather than the package) to set up the section entries and other entities (text is populated and the package cache is accessed).

Thereafter, the statements in the bound file behave the same as they would if you were using dynamic SQL. For example, sections are implicitly recompiled for database definition language invalidations, special register updates. The new syntax is defined as follows:
DB2 BIND filename GENERIC 'STATICASDYNAMIC [YES|NO]'