EFD directives and mapping rules
The definition of the table is based on the extended file description (ISS) generated by the Compiler.
In order to generate ISS dictionaries, compile the program with the
-efc compiler option.
Mapping rules
The sqlize process will map only elementary fields to table columns and only the larger record type when there are multiple record definitions. Default rules used to map COBOL fields to table columns can be changed by using EFD directives.
Default Rules
COBOL file name | RDBMS table |
---|
COBOL record | table row |
COBOL field | table column |
COBOL key | table index |
Redefines are allowed only for the entire record and must be redirected to a different table (See
WHEN Directive).
FILLER data items are not mapped to table columns. You can overwrite this behavior using the
NAME Directive in order to associate a column name with COBOL FILLER.
Cobol group items are not mapped to table columns, instead they are mapped to elementary fields of the group. You can change this approach using the
USE GROUP Directive.
There is not a corresponding RDBMS table definition for the COBOL OCCURS statement. For this reason the default behavior is to append a sequential number to the field name. For example:
01 myoccurs occurs 10 times. 03 customer-code pic 9(5). 03 customer-name pic x(30). |
Will be mapped in the table as
customer_code_1 customer-name_1 … … customer_code_3 customer-name_3 customer_code_4 customer-name_4 customer_code_5 customer-name_5 ... ... |
Using EFD directives
Directives are used when a COBOL file descriptor is mapped to a database field. The $EFD prefix indicates to the compiler that the proceeding command is used during the generation of the data dictionary.
Consult
EFD Directives for a detailed description of the available EFD directives.
Invalid Data
Not all COBOL data is valid for SQL rules, because COBOL allows you to store any value in any field while SQL expects that the value is consistent with the field type. For this reason, for example, spaces or low-values in Numeric and Date fields are not a problem in COBOL, but generate a conversion error in SQL.
Invalid data is managed by the c-tree SQL engine as follows: when invalid data is found in a field, NULL is returned for that field.