Setting Up File Aliases

With AcuXDBC, you can define file aliases when adding XFDs to your system catalog with xdbcutil.

A file alias is a way to map data files, .xfd files, and SQL tables. It is used at runtime to dynamically reassign a file name that is referenced in an ASSIGN clause or, if the ASSIGN clause is a variable, from the FILE directive.

File aliases are useful when:

These situations can easily occur in a large company, in which one COBOL file needs to point to more than one company. For example, Corporation A supports several other companies (say, company01 and company 02) and wants to use the same code to point to each company. Corporation A has named its COBOL file company, so the XFD file would be called company.xfd. Because Corporation A wants to use this same code for company01 and company02, it has set up the code to point to data files company01.dat and company02.dat.

Let's also say that Corporation A wants to use a different name when referring to the data files from SQL (maybe the name is too long or cumbersome). No problem! Corporation A can specify all three components: the XFD name, the database table name, and the data file name. All of this information, along with the schema to load the tables into, is specified using the Windows batch file addfile.bat or the UNIX/Linux shell script addfile.sh. You can also you xdbcutil.exe on Windows or the xdbcutil/ on UNIX/Linux.

Note that another issue that you may need to consider is the configuration file variable FILE_PREFIX, which points to the directory in which your files are stored.

If your .xfd and data files for a table have different names, define a file name alias on the xdbcutil command line or in the list file using the standard syntax. Simply enter the alias as the third parameter.

xfilename[#[tablename][#filename]] 

For example:

Acme#Table1#Company1

indicates that an alias should be assigned to the file named Company1. In this example, Acme is the name of the XFD file being read, Table1 is the name to be used in SQL statements, and Company1 plus FILE_SUFFIX, if any, is the filename that will be used.

See Loading the System Catalog with Your XFDs for information about loading XFD files.