ContentsIndexPreviousNext

7.3.8 Use Group Directive

The USE GROUP directive allows you to enter a group item into the "virtual" database as a single field, instead of using the elements contained in the group. This is necessary if the item is stored in your Windows application as a group, rather than as individual fields.

Combining fields of data into meaningful groups for storage also improves I/O efficiency.

Syntax

$XFD USE GROUP
  or
*(( 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.

Example

You might use this directive with fields like 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.