Indicate truncated values

When an SQL statement returns a non-null value into a host-variable character array, it might truncate the value to fit into the variable. If you define an indicator variable for this host variable, :
  • Sets the SQLSTATE variable to "01004" to signal the occurrence of truncation.

    For more information about SQLSTATE, see List of SQLSTATE class codes.) also sets sqlwarn1 of the sqlca.sqlwarn structure to W.

  • Sets the associated indicator variable equal to the size in bytes of the SQL host variable before truncation.

If you do not define an indicator variable, still sets SQLSTATE and sqlca.sqlwarn to signal the truncation. However, your program has no way to determine how much data was truncated.

If the database server returns a value that is not truncated or null, sets the indicator variable to 0.