Checking host variables

When using host variables, the type and length of each table column is compared to the type and length of the host variable used with the column to ensure they match. However there are some guidelines and limitations in how host variables are checked.

Host variable checking only applies when the host variable information is available, which is when processing packages and DBRMs. Keep this in mind:

  • To enable host variable checking for packages, set the HOSTVAR user parameter to YES.

Host variables are checked in the following expressions:

  • Host variables used in predicates in the WHERE clause will be checked.
  • Host variables that are not part of a more complex expression will be checked. Only the following formats will be checked:
    columnname <oper> :hostvariable
    and
    :hostvariable <oper> columnname
    and
    columnname BETWEEN :hostvariable1 AND :hostvariable2
    where <oper> can be LIKE or any valid combination of ¬, =, <, and >.
When checking each host variable, there are three possible outcomes:
  1. The host variable is checked against the column and they match each other. No message is printed.
  2. The host variable is checked against the column and they do not match each other. The ANL1077W message is displayed.
  3. The host variable is not checked against the column. The ANL1079I message is displayed.