Handling Errors in Operations Using Null-Capable Fields

When a null-capable field is referenced in a program, the ILE COBOL compiler does not check if the field is actually null or not. It is the responsibility of the programmer to ensure that fields referenced as null-capable actually contain or do not contain null values (in other words, a 0 or 1) in the null map and null key map for the fields. If a field is defined in a program as null-capable, but is not defined as null-capable in the database, no checking is done by ILE COBOL, and whatever is in the field is used at the time of execution. At program initialization, fields for externally described files are set to zero. For program described files, it is the programmer's responsibility to ensure that their null-capable fields are set to zero at program initialization.

If the file is null-capable, and the ALWNULL attribute has not been specified, when you attempt to read a record that has a null value, the read will fail with a file status of 90.

If the file is not null-capable and the ALWNULL attribute of the ASSIGN clause is specified, the null map and null key map are returned from the database as zeros. And, when the null maps and null key maps are passed to the database, they are ignored.