FILE directive

The FILE directive supplies a starting name from which the XFD file name is formed. This directive is required only when the file name in the COBOL code is nonspecific. For example, you would use this directive when the SELECT for the file has a variable ASSIGN name (ASSIGN TO variable_name). In this situation, the interface cannot form a file name automatically, and you must provide a name.

You can encounter this situation when you are using AcuXDBC's file alias feature. For example, the description section of your COBOL file may reference multiple data files with the same format. Each of these data files represents a distinct table in the database, but one XFD file describes them all.

A starting name is a short file name that serves as the basis for the XFD name.

Syntax

$XFD FILE=name

or

*(( XFD FILE=name ))

This directive must appear on the line immediately preceding the file's FD.

Example

The sample file file_dir.cbl contains code that demonstrates the FILE directive. Suppose your SELECT statement has a variable ASSIGN name such as the one shown here:

SELECT work-file
     ASSIGN to pet-file.

You must add the FILE directive as shown here:

       FILE-CONTROL.
           SELECT work-file
              ASSIGN TO pet-file
              ORGANIZATION IS INDEXED
              ACCESS IS DYNAMIC
              RECORD KEY IS type-id
              FILE STATUS IS qa-file-status.
       DATA DIVISION.
       FILE SECTION.
      $XFD FILE=patients
       FD  work-file.
       01  pet-record.
           05  type-id.
               10  atype            pic x.
               10  ano              pic 99.
           05  owner                pic x(30).
           05  breed                pic x(25).
           05  gender               pic x.
       WORKING-STORAGE SECTION.
       01  pet-file                 pic x(8). 
       01  qa-file-status           pic xx.

Note that after compilation, the data directory now contains the files file_dir.acu and patients.xfd. Because the FILE directive assigns the name of the XFD file, this is different from previous examples in which both the .scu file and the .xfd file took the same base name as the .cbl file.

See Setting Up File Aliases for information on file alias and how to load XFDs to different tables and databases using the system catalog utility program (xdbcutil).