CORRESPONDING phrase

The CORRESPONDING (CORR) phrase causes ADD, SUBTRACT, and MOVE operations to be performed on elementary data items of the same name if the alphanumeric group item or national group item to which they belong is specified.

A national group is processed as a group item when the CORRESPONDING phrase is used.

Both identifiers that follow the keyword CORRESPONDING must name group items. In this discussion, these identifiers are referred to as identifier-1 and identifier-2. identifier-1 references the sending group item. identifier-2 references the receiving group item.

Two subordinate data items, one from identifier-1 and one from identifier-2, correspond if the following conditions are true:

  • In an ADD or SUBTRACT statement, both of the data items are elementary numeric data items. Other data items are ignored.
  • In a MOVE statement, at least one of the data items is an elementary item, and the move is permitted by the move rules.
  • The two subordinate items have the same name and the same qualifiers up to but not including identifier-1 and identifier-2.
  • The subordinate items are not identified by the keyword FILLER.
  • Neither identifier-1 nor identifier-2 is described as a level 66, 77, or 88 item, and neither is described as an index data item. Neither identifier-1 nor identifier-2 can be reference-modified.
  • Neither identifier-1 nor identifier-2 is described with USAGE POINTER, USAGE FUNCTION-POINTER, USAGE PROCEDURE-POINTER, or USAGE OBJECT REFERENCE.
  • The subordinate items do not include a REDEFINES, RENAMES, OCCURS, USAGE INDEX, USAGE POINTER, USAGE PROCEDURE-POINTER, USAGE FUNCTION-POINTER, or USAGE OBJECT REFERENCE clause in their descriptions.

    However, identifier-1 and identifier-2 themselves can contain or be subordinate to items that contain a REDEFINES or OCCURS clause in their descriptions.

  • The name of each subordinate data item that satisfies these conditions is unique after application of implicit qualifiers.

identifier-1, identifier-2, or both can be subordinate to a FILLER item.

For example, consider two data hierarchies defined as follows:


05 ITEM-1 OCCURS 6.
   10  ITEM-A PIC S9(3).
   10  ITEM-B PIC +99.9.
   10  ITEM-C PIC X(4).
   10  ITEM-D REDEFINES ITEM-C PIC 9(4).
   10  ITEM-E USAGE COMP-1.
   10  ITEM-F USAGE INDEX.
05 ITEM-2.
   10  ITEM-A PIC 99.
   10  ITEM-B PIC +9V9.
   10  ITEM-C PIC A(4).
   10  ITEM-D PIC 9(4).
   10  ITEM-E PIC 9(9) USAGE COMP.
   10  ITEM-F USAGE INDEX.

If ADD CORR ITEM-2 TO ITEM-1(x) is specified, ITEM-A and ITEM-A(x), ITEM-B and ITEM-B(x), and ITEM-E and ITEM-E(x) are considered to be corresponding and are added together. ITEM-C and ITEM-C(x) are not included because they are not numeric. ITEM-D and ITEM-D(x) are not included because ITEM-D(x) includes a REDEFINES clause in its data description. ITEM-F and ITEM-F(x) are not included because they are index data items. Note that ITEM-1 is valid as either identifier-1 or identifier-2.

If any of the individual operations in the ADD CORRESPONDING statement produces a size error condition, imperative-statement-1 in the ON SIZE ERROR phrase is not executed until all of the individual additions are completed.