The USE GROUP directive allows you to enter a group item into the XFD as a single field, instead of using the elements contained in the group. This is necessary if the item is stored in a pre-existing database as a group, rather than as individual fields.
Combining fields of data into meaningful groups for database storage also improves I/O efficiency.
$XFD USE GROUP
*(( XFD USE GROUP ))
By default, the USE GROUP directive implies that the consolidated field is alphanumeric. If you want a numeric field, simply add the word NUMERIC at the end of the directive.
For example, the directive in the following code combines the functions of the USE GROUP and DATE directives, and indicates that the date should be entered into the XFD as a single date-formatted data item instead of three distinct fields:
*(( XFD USE GROUP, DATE )) 03 date-entered. 05 yy pic 99. 05 mm pic 99. 05 dd pic 99.
Either a comma or a space (or both) may separate the word DATE from the words USE GROUP.
Other fields with which you might use this directive include multi-part account numbers or department numbers, or keys that are referenced as a unit but not by their individual pieces. Here's an example of an item that might be grouped:
$xfd use group 01 gl-acct-no. 03 main-acct pic 9(4). 03 sub-acct pic 9(3). 03 dept-no pic 9(3).
If you are using a pre-existing database in which certain fields are grouped, they must also be grouped in your COBOL FD.
If the database does not yet exist, keep in mind that combining fields into groups typically improves execution speed. Whether to group fields or not also depends on how you want to process them. Do you always store and use the fields together? Someone who really knows how the data is being used might help to identify groups of fields that can be combined to speed processing.