TOCPREVNEXTINDEX

AcuODBC User's Guide
Version 6.0

6.3.5 FILE Directive

The FILE directive supplies a starting name from which the data dictionary 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 AcuODBC'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. See section 3.7, "File Aliases," for more information.

A starting name is a short file name that serves as the basis for the dictionary name. See section 6.2.5, "Naming the XFD File," for additional information.

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 than in previous examples where both the ".acu" file and the ".xfd" file took the same base name as the ".cbl" file.


Acucorp, Inc.
Voice: (800) 262-6585 (U.S.A. and Canada)
Voice: (858) 689-4500
Fax: (858) 689-4550

Please share your comments on this manual
or on any Acucorp documentation with the
Acucorp Communications Department.
TOCPREVNEXTINDEX
1988-2003 Acucorp, Inc.
All rights reserved.