CREATEXFD directive

Use the CREATEXFD directive to tell the compiler to generate XFDs for the COBOL files contained in your program.

Syntax

$SET CREATEXFD(version=n, xfd-directory=pathname, file-type=all)

All of the arguments are optional, and can be given in any order.

"version=n" Causes XFD files of type n to be used. Currently, "6" is the only valid value here. Any other value causes XFD files of the latest version to be created
"xfd-directory=path" Causes the XFD files to be created in the directory named by pathname. pathname must be a valid directory, either absolute or relative, and must be writable to the user
"file-type=all" Causes XFD files for all file types to be created. Without this argument, the compiler creates XFD files for only indexed files. If anything other than "all" is specified, the compiler creates XFD files only for indexed files

Example

In the following example, the CREATEXFD directive tells the compiler to generate Version 7 XFDs in the directory v:\animals\xfds for all file types found in the FD — indexed, relative, and fixed-length sequential.

You will need to add the CREATEXFD directive before the first COBOL “SELECT” statement.

$SET CREATEXFD
     SELECT jr-file
        ASSIGN TO "animals"
        ORGANIZATION IS INDEXED
        ACCESS IS DYNAMIC
        RECORD KEY IS patient-id
        FILE STATUS IS jr-file-status.

 DATA DIVISION.
 FILE SECTION.
 FD  jr-file.
 01  jr-record.
     03  animal-info.
         05  patient-id                  pic 9(5).
         05  atype                       pic x.
         05  ctype redefines atype       pic x.