contents.gifindex.gifprev1.gifnext1.gif

7.2.1 How the Data Dictionary is Formed

Acucorp data dictionaries (XFDs) enable the AcuODBC interface to convert COBOL records in the indexed or relative file system to "rows" and "columns" of data that can be accessed by common SQL commands. The rows and columns of data make up a "table" in a what can be considered a "virtual" database.

In the database table, each column contains the values for one field. 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 which are named in KEY IS phrases of SELECT verbs in the FILE CONTROL section). This ensures that data from all COBOL records will fit 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 will not become a column in the data dictionary table. Instead, the elementary items subordinate to the named group item will each become a column.


You can force a group item to be a column by using the USE GROUP directive (described in Section 7.3.8 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 data dictionary maps fields from all records of a file to the corresponding locations in the "master" (largest) record of the file, and thus to the "virtual" database table. Only the fields included in the XFD will be available to any ODBC applications. Since AcuODBC has access to the data dictionary, it "knows" where the data from a given COBOL record fits in the database tables. This activity is invisible to the COBOL application.

For example, if your program has one file with the three records shown on the next page, the underlined fields will be included in the database table by default (this example assumes that ar-codes-key is named in a KEY IS phrase). Some fields will not appear in the table, but the data dictionary will map them to the "master" field names. The interface thus will eliminate redundancies and give you optimum performance.


Note: In the following example, the ship-weight and ship-instruct fields would be invisible to any ODBC application, unless you use a directive to change that situation.


01 ar-codes-record.

03 ar-codes-key.

05 ar-code-type pic x.

05 ar-code-num pic 999.

01 ship-code-record.

03 filler pic x(4).

03 ship-weight pic s999v9.

03 ship-instruct pic x(15).

01 terms-code-record.

03 filler pic x(4).

03 terms-rate-1 pic s9v999.

03 terms-days-1 pic 9(3).

03 terms-rate-2 pic s9v999.

03 terms-descript pic x(15).

The diagram below shows how AcuODBC identifies database columns for some of the fields in the COBOL record, while other fields are mapped to those columns by the data dictionary; this means that all the fields are accessible to the COBOL program.

odb00005.gif


Note: If your application reads a record that should be a ship-code-record, the data that is displayed will be unreadable. If you try to modify that record, you may receive an error message.



Important: Each field in your Windows application must correspond to a field in your COBOL FD or XFD. To ensure that this is the case, you may need to add fields to the data dictionary using the NAME directive.


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