How XFDs are Formed

XFDs enable the Micro Focus XDBC interface to populate tables in a system catalog that map COBOL records in the indexed, relative, or binary sequential file to rows and columns of data that can be accessed by common SQL commands.

In the database table, each column contains the values for one data item. The column names are essentially the field names. The table that is built is based on the largest record in the COBOL file and contains the fields from that record, plus any key fields (key fields are those that are named in KEY IS phrases of SELECT statements in the FILE CONTROL section). This ensures that data from all COBOL records fits within the table and simplifies the storage and retrieval process. If you were to examine the database columns, only the fields from the largest record and the key fields would appear.

Note: If the field named in the KEY IS phrase is a group item, it does not become a column in the XFD table. Instead, the elementary items subordinate to the named group item each become a column. You can force a group item to be a column by using the USE GROUP directive.

With multiple record formats (level 01), not all COBOL fields are represented in the database by name, but all fields are storable and retrievable. The XFD maps fields from all records of a file to the corresponding locations in the "master" (largest) record of the file, and thus to the COBOL database table. Only the fields included in the XFD will be available to ODBC or JDBC applications. Because Micro Focus XDBC has access to the table holding information from the XFD, it knows where the data from a given COBOL record fits in the database tables. This activity is invisible to the ODBC or JDBC application.

You can use the WHEN directive to include multiple record definitions in the XFD. Alternatively, you can create views of your data using the SQL command, CREATE VIEW.

CAUTION:
Each field or group of fields in your COBOL FD or XFD field must correspond to an SQL column name. To ensure that this is the case, you may need to use the NAME directive to add field names to the XFD.

To help you determine whether any fields need to be added, the next section describes which fields are automatically included and excluded.