Mapping Other Files to an XFD

At run time, 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 (such as CUST0001, CUST0002, and CUST0003). It's not necessary to have a separate XFD for each file, as long as their record definitions are the same.

The individual files can all be mapped to the same XFD via an ACUFH configuration file variable called XFD_MAP. The following paragraphs describe how this 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 XFD 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, use this same XFD, enter the following in your ACUFH 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:

CUST????   matches CUST0001 and CUSTOMER;

does not match CUST001 or CUST00001

CUST* matches all of the above
CUST*1 matches CUST001 and CUST0001 and CUST00001;

does not match CUSTOMER

*OMER matches CUSTOMER;

does not match CUST001 or CUST0001

The XFD_MAP variable is read during the open file stage of any Connector interfaces linked into the run time system.

XFD values can be replaced or added to the end of existing XFD map values by setting the XFD_MAP_RESETS ACUFH configuration file variable. This variable determines whether setting XFD_MAP adds to or replaces the existing value. When this variable is set to 0 (off, false, no), setting XFD_MAP adds new value patterns to the end of the existing value. When XFD_MAP_RESETS is set to 1 (on, true, yes), setting XFD_MAP replaces the existing value with a new value. The default value is 1 (on, true, yes).

This variable may be useful if you need to include multiple XFD_MAP lines in an ACUFH configuration file and want to avoid setting and resetting the variable. When multiple lines exist, all patterns are used in the order they are listed.