Creating XFD Files

To create an XFD file, include the CREATEXFD directive in your COBOL source code and then compile. For example, your FILE SECTION might look like this:

 FILE SECTION.
 FD  jr-file.
$SET CREATEXFD 
 01  jr-record.
     03  animal-info.
         05  patient-id                  pic x(5).
         05  atype                       pic x.
         05  ctype redefines atype       pic x.

When you specify the CREATEXFD directive with no parameters, an .xfd file is created for each indexed data file specified in the compiled program. XFDs are generated in XML format in the latest XFD version available and are stored in your source code directory by default.

Specify "all" as shown in the following sample to generate XFDs for all indexed, relative, and sequential files. For example:

 FILE SECTION.
 FD  jr-file.
$SET CREATEXFD(FILE-TYPE=ALL)
 01  jr-record.
     03  animal-info.
         05  patient-id                  pic x(5).
         05  atype                       pic x.
         05  ctype redefines atype       pic x.

Once you compile with the CREATEXFD directive, each COBOL file has a corresponding .xfd file. The directive creates .xfd files without changing anything in the object code.

Creating XFD files at compile time offers two significant advantages:

The XFDs contain information about such things as the structure of the COBOL files, the names of the fields, and their format. However, this information is only a subset of the information available in most applications. To map your COBOL fields to tables that are more meaningful and useful to the application, you may need to add additional information to your XFDs. To add information to your XFDs, or to change the default names of the existing fields, you must use directives, or optional comments, in the FD section of your COBOL program. These directives are explained in the section Using XFD Directives.