When performing an SQL INSERT statement, Relativity needs to construct a new COBOL record.
It needs to determine the length of the new record and the value of every byte in the new record. The resulting record must
be a valid record for the file to which it is to be written. It must also produce a row of the table on which the INSERT statement
is operating.
To be a valid record, the record must "look like" one of the record types that a COBOL application might write to the file.
It must have the correct length, and all data items which would be set by a COBOL application statement. All variable-occurrence
repeating data items must have occurrence counts that are between the minimum and maximum values.
To produce a row of the table means that the record must satisfy the table filter, if any, and also the record type filter
for one of the record types on which the table is defined. The user would also expect that the column values returned from
a SELECT statement of this row would match the column values supplied on the INSERT statement, except that columns omitted
from the INSERT statement may have null or default values.
Note: The
Constrained property selected in a
Custom Data Types limits the column value during an SQL INSERT or SQL UPDATE operation to one of the true values indicated by an 88-level condition-name
defined on the data item associated with the column. You can add condition items if the program does not already contain them.
The Relativity DBMS will select a record type (if the table is defined on multiple record types) and use the single 01-level
item in that record type. This item will determine the record length and record layout. All areas of the record not covered
by items in the record type will be set to spaces. Items belonging to the record will receive values as follows:
-
If a column is associated with a data item, the data item will receive its value from the column, either a user-specified
column value or the column's default value.
-
If no column is associated with an item, and if the table filter or record type filter determines a single value for an item,
the item will be set to the value so determined. See the discussion of filters in
Determining Record Type for more information about how a filter determines an item value.
-
If no column is associated with a data item but the data item has a default value, the item will be set to its default value.
-
If an item receives no value by any of the above means, the item will be set to zero if it is numeric. Nonnumeric items will
not be set explicitly; the record area will be initialized to spaces before any items are set.
In addition, an item may receive a value indirectly, as follows:
- When a value is stored in a function item that is reversible (that is, its parameters can be computed from the stored value),
the function's parameters are stored into the function item's arguments.
- If a column is associated with an item that has an associated null condition-name, when the column value is stored, the conditional
variable data item associated with the null condition-name must also be set appropriately.
- If necessary, the Relativity DBMS may set values in unset items to force the table filter and record type filter expressions
to be "true".