To maintain the integrity of the source data and to ensure that any data written from your application back to the COBOL source is accurate, you must provide a representational mapping between COBOL's SPACES and LOW-VALUES and the corresponding SQL column values.
Use the NULL_NUMERIC_WRITE variable to indicate how SQL NULLs in numeric data should be translated into COBOL data. For data returned to the COBOL files (WRITEs), indicate whether the NULLs in numeric data should be interpreted as SPACES, LOW-VALUES, or zero.
Valid values are:
NULL_NUMERIC_WRITE spaces NULL_NUMERIC_WRITE low-values NULL_NUMERIC_WRITE 0
By default, numeric data is interpreted as zero on output to the COBOL source.
Numeric fields that take the form of one of the computational types further complicate the situation. For most comp fields, LOW-VALUES and SPACES are valid values. See the configuration variable NULL_NUMERIC_READ for examples. To prevent erroneous information being written to the COBOL data files by the insert of a NULL value, tables created with comp fields that could be misinterpreted are created with the NOT NULL constraint on these columns. The following describes these columns:
|Other comp||See above types|
In this case, if you attempt to insert a row into the COBOL file and specify NULL for one of these columns, or do not specify a value, you will receive the error message:
“***** ERROR: NULL not allowed for column”
From within the command-line query tool, you can check which columns have this constraint. For example, to find out which columns in the table COMPTEST will not allow a null value, use the command:
select column_name, ordinal_position from information_schema.columns where table_name = 'COMPTEST' and is_nullable = 'N';
For columns having the NOT NULL constraint, you must specify a value.