Data Dictionaries

ACUCOBOL-GT's XML interface depends on XFDs, or data dictionaries, to map COBOL records to the XML data type. These dictionaries are based on the standard COBOL file descriptors (FDs). XFD Files for more details.) These files are created at compile time. The structure of XFDs used by alfred and the Acu4GL® and AcuXDBC® interfaces has been enhanced in order to mirror the rich structure of XML.

To create the XFDs, you specify "-Fa" on the command line when you compile your COBOL source. This option signals the compiler to create an XFD file for every indexed, relative, or sequential file contained in the program. To prevent naming errors, you should also include the "-Fc" option, which tells the compiler that the field names in the resulting XFDs must match the element names in the COBOL source exactly.

XFDs include information about the structure of their associated data files. They provide a map between the COBOL files used by the program and the external data file that the program receives (in this case, an XML document).

Using the XFDs and the new XML interface, the COBOL program can open an XML document and read from it or write to it using COBOL file I/O syntax.

To control precisely how the XFDs are built, you can use data dictionary directives with AcuXML, as you can with any ACUCOBOL-GT file system interface. Directives are optional comments that you place into your FDs in your COBOL source code. For more information, see How the Terminal Manager Works.

For instance, to store items at group level, you can change the database table names in the XFDs. Likewise, you can store dates as database "date" fields. This is all done with directives. Note that if you use the XFD Name directive to define XML data elements, you must use the name exactly as it appears in the XML tag, including case. If you do not match the name or case exactly, the FD items do not get filled when the interface parses the XML data.