USE GROUP XFD directive

The USE GROUP XFD directive allows you to enter a group item into the database as a single field, instead of using the elements contained in the group. This is necessary if the item is stored in an 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.

Syntax

$XFD USE GROUP

By default, the USE GROUP XFD directive implies that the consolidated field is alphanumeric. If you want a numeric field, simply add the word NUMERIC at the end of the XFD directive.

Example 1 – Combining DATE and USE GROUP XFD directives

For example, the XFD directive in the following code combines the functions of the USE GROUP and DATE XFD directives, and indicates that the date should be entered into the database 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".

Example 2 – Forming larger units

Other fields with which you might use this XFD 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 an existing database in which certain fields are grouped, they must also be grouped in your COBOL file descriptor.

If the database does not yet exist, keep in mind that combining fields into groups can improve execution speed. Whether to group fields or not also depends on whether they are always stored and used 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.