Null indicator byte processing

The Db2® UNLOAD utility data format uses a single byte for the Db2® null value, located immediately before the data for each nullable column, in the output data set. The value in this byte is set to X'00' if the column contains a value and X'FF' when the column contains the Db2® null value. The Db2® UNLOAD utility automatically places the appropriate value in the null indicator byte in the output data set.

FM/Db2 automatically generates a File Manager "base" template when the template processing option is set to 3 or 4 on the To panel. This template includes fields for the null indicator bytes as appropriate.

When a copybook is used to describe the output data, FM/Db2 attempts to generate a reasonable mapping between the template for the Db2® object and the template for the output data set. The data format used by the Db2® UNLOAD utility is fixed, therefore the data format described by the copybook should reflect this format, to avoid data mismatch problems.

The Db2® null indicator byte in a user-specified copybook is successfully mapped when:
  • It immediately precedes a nonvarying target field, or precedes the length field of a varying target field.
  • The null indicator byte does not overlap any field that has already been mapped.
  • The field name for the null indicator byte contains "NULL". In this case, FM/Db2 documents the mapping as comments in the generated JCL for the Db2® UNLOAD utility.
Other types of mapping, or null indicator byte usage are not supported, including:
  • A copybook that would map a nullable Db2® column to a data field without a null indicator byte.
  • A copybook that would map a not-nullable Db2® column to a data field with a null indicator byte.
  • A copybook that uses null indicator fields that are not one byte in length, or are not located immediately before the data for the column to which they pertain.

Related references