ContentsIndexPreviousNext

3.7 File Aliases

A file alias provides a way to map data files, XFD files, and SQL tables. File aliases are useful when

A DSN can support a maximum of 64 aliases.

This section describes the fields on the File Alias tab and also provides an example.

Table Name

The table name you enter here is the name of one of the tables in the data source that your ODBC-enabled application opens, as shown in the Microsoft Access example below.

odb00004.gif

Table names must be unique. You cannot add an alias to the list if you use a duplicate table name.

XFD

Enter the name of the ".xfd" file to be used with the table specified in the Table Name field. Enter only the file name, with neither the path leading to the file nor the extension. AcuODBC takes the path from the XFD Directory field on the General tab.

Data File

Enter the full path (including filename) where the file containing the data for the specified table is located. The data file need not be in the same directory as the ".xfd" file.

Write Permission

This is available only for read/write versions of AcuODBC. Indicate write permissions for the specified tables. You can specify "DSN Default," "Read Only," or "Read/Write". "DSN Default" tells AcuODBC to use the permission established in the Read Only field on the Advanced tab. Selecting "Read Only" or "Read/Write" overrides the setting on the Advanced tab.


Note: Field- or column-level write protection can be further defined by adding the ACUODBC READ-ONLY and ACUODBC HIDDEN directives to the file descriptor (FD) of your COBOL program.

To add the file alias to the DSN definition, click Add. The alias is added to the list box in the lower part of the tab, with a check box to the far left of the row. The check in the box indicates that AcuODBC will include that entry when performing operations. Clear the check box if you do not want AcuODBC to include this alias. Select the checkbox again when you want to include the alias. AcuODBC keeps the alias information in memory so that you only need to select or clear a check box to indicate whether a particular file alias should be used by AcuODBC.

Example

Your COBOL program has one description section that references three data files: "file1", "file2", and "file3". Because there is only one description section in your COBOL file, you will get an ".xfd" file for only one of these three data files. Your ODBC-enabled application needs to see these three data files as three tables (called "cats," "dogs," and "fish," respectively) in a database. The code in your program looks like this.

.
.
.
 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=pets
 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  sex                  pic x.
     05  neutered             pic x.
 WORKING-STORAGE SECTION.
 01  pet-file                 pic x(10).
 01  qa-file-status           pic xx.
.
.
.

Note the use of the FILE directive in the code. You must include a FILE directive as a starting name from which to form the name of the data dictionary file. (In this example, since there is no value in pet-file at compile time, the compiler could not tell what name to assign to the data dictionary.) See section 6.3.7, "FILE Directive" for more information on this and other directives.

If the "Read Only" DSN permission is set to "Yes" on the Advanced tab (the check box is selected) and you want to be able to edit the "cats" table, the File Alias tab for your DSN called "family_pets" should look like this to


Note: For information on file aliasing and the WHEN directive, see section 6.3.11, "WHEN Directive".
More:

To modify a file alias

To delete a file alias