The compiler needs to give a name to each XFD file (data dictionary) that is built. It attempts to build the name from your COBOL code, although there are some instances where the name in the code is nonspecific, and you must provide a name.
Each XFD name is built from a starting name that is derived (if possible) from the SELECT statement in your COBOL code. The following paragraphs explain how that occurs.
ASSIGN name is a variable
If the SELECT for the file has a variable ASSIGN name (ASSIGN TO filename), then you must specify a starting name for the XFD file via a FILE directive in your code. This process is described in the File Directive topic.
ASSIGN name is a constant
If the SELECT for the file has a constant ASSIGN name (such as ASSIGN TO COMPFILE.DAT), then that name is used as the starting name for the XFD name.
ASSIGN name is generic
If the ASSIGN phrase refers to a generic device (such as ASSIGN TO DISK), then the compiler uses the SELECT name as the starting name.
Forming the final XFD name
From the starting name, the final name is formed as follows:
1. The compiler removes any extensions from the starting name.
2. It constructs a universal base name by stripping out directory information that fits any of the formats used by the operating systems that run the ACUCOBOL-GT compiler.
3. It reduces the base name to eight characters and converts it to lower case.
4. It appends the letters .xfd to the base name.
Mapping Multiple files to an XFD
At runtime, it is possible to use a single XFD for files that have different names. For example, suppose a site has customer files that have identical structures but different names (CUST0001, CUST0002, CUST0003, etc.). It's not necessary to have a separate XFD for each file, so long as their record definitions are the same.
The individual files can all be mapped to the same XFD via a runtime configuration variable called XFD-MAP. You may not have several XFD-MAP lines. You may have more than one entry in XFD-MAP. The following paragraphs describe how it works.
Suppose your COBOL application has a SELECT with a variable ASSIGN name, such as customer-file. This variable assumes different values (such as CUST0001 and CUST0002) during program execution.
Before compiling the application, you would use the FILE directive to provide a base name for the XFD. Suppose you provide CUST as the base. The compiler would then generate an XFD named cust.xfd. (The compiler always converts XFD names to lower case.)
To ensure that all customer files, each having a unique name, will use this same XFD, you make this entry in your runtime configuration file:
XFD-MAP CUST* = CUST
The asterisk (*) in the example is a wildcard that matches any number of characters. Note that the extension .xfd should not be included in the map. This statement would cause the XFD cust.xfd to be used for all files whose names begin with CUST.
The XFD-MAP variable has this syntax:
XFD-MAP [pattern = base-xfd-name] ...
where pattern consists of any valid filename characters and may include * or ?. These two characters have special meanings in the pattern:
* matches any number of characters
? matches a single occurrence of any character
For example:
The XFD-MAP variable is read during the open file stage of any Acu4GL interfaces linked into the runtime.