contents.gifindex.gifprev0.gifnext1.gif

Using Directives

ACUCOBOL-GT data dictionaries are based on your COBOL FDs. For this reason we call them Extended FDs or XFDs. Each dictionary describes all of the fields for one file.

acu00010.gif

Directives are optional comments that you can use in your FDs to control how things look on the database side. Many applications won't use directives at all. They're most commonly used when a site intends to do a lot of work with the database management system outside of the COBOL application, and wants to control how the database table is built.

Directives are special comments placed into an FD in your COBOL source code. They guide the building of the data dictionaries, which in turn guide the building of the database table.

Each directive includes the letters XFD. These three letters indicate to the compiler that the comment is to be used in Data Dictionary generation.

Directives offer you a great deal of control over how the database table is built. Among other things, they enable you to:

* specify a column name to be used in the database table, in place of a COBOL field name.

* map elementary items of a group item together into a single column.

* cause numeric COBOL data to be treated as a text string in the database.

* cause the fields from a specific record in a file to appear in the database table (rather than just the fields from the largest record).

* assign a column the DATE type, so that it will have the built-in functionality that dates have in the RDBMS.

* give a name to the data dictionary file itself.

Directives are always placed within a COBOL FD. They do not affect Procedure Division I/O statements, and they do not change your COBOL fields in any way. Rather, they guide the building of the data dictionaries, giving you a measure of control over the way COBOL data is mapped to database fields.

IMPORTANT

Except for Oracle and Informix, each field in the database must correspond to a data item in your COBOL FD. For Sybase, Microsoft SQL Server, and ODBC, you may not have any database table fields that have no counterpart in the COBOL FD. The reverse is not true; there may be COBOL fields which the XFD maps to the database table columns, but do not appear as column names. You must use caution, as "un-mapped" and "not-null" fields can create major problems.

This correspondence happens automatically when the database is newly generated by the Acu4GL interface. If the database is pre-existing, you should check for the correspondence, and use directives if necessary to make it complete.

Data dictionaries may be built directly from your source code with no directives if the default mapping rules described in Data Dictionaries and New and Existing Databases are sufficient for your situation. If you would like to override the default mapping behavior, or map a field to a different name, then you would add directives to your COBOL code.