Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

CORRESPONDING phrase

The CORRESPONDING phrase enables the user to write one statement to perform operations on several elementary items of the same name in different groups.

  1. The word CORRESPONDING may be abbreviated as CORR.

  2. All identifiers must refer to group items. If an identifier refers to a national group item, this is not processed like an elementary item but like a group.

  3. Pairs of data items correspond if the following conditions exist; all other items are ignored for the operation:

  4. Both data items have the same name and qualification, up to, but not necessarily including, identifier-1 and identifier-2.

  5. None of the data items is declared with FILLER.

  6. In the case of MOVE CORRESPONDING, at least one of the data items is an elementary item, and the MOVE statement resulting from it applies in accordance with the rules of the MOVE statement; both data items are elementary items in the case of ADD CORRESPONDING or SUBTRACT CORRESPONDING.

  7. A data item that is subordinate to identifier-1 or identifier-2 and which is defined with a REDEFINES, RENAMES, OCCURS, or USAGE IS INDEX clause or is of class “object” or “pointer” will be ignored; any items which are subordinate to such items are also ignored. However, identifier-1 or identifier-2 may be defined with REDEFINES or OCCURS clauses or be subordinate to data items defined with REDEFINES or OCCURS clauses.
  8. The CORRESPONDING phrase cannot be applied to identifiers that are subjected to reference modification.

Example 8-16

In this example, elementary items in EMPLOYEE-RECORD are subtracted from corresponding items in PAYROLL-CHECK.

Procedure Division statement:

SUBTRACT CORRESPONDING EMPLOYEE-RECORD FROM PAYROLL-CHECK.

Data Division entries:
01  EMPLOYEE-RECORD. 
    02  EMPLOYEE-NUMBER.
        03  PLANT-LOCATION...
        03  CLOCK-NUMBER.
            04  SHIFT-CODE...
            04  CONTROL-NUMBER... 
    02  WAGES.
        03  HOURS-WORKED... 
        03  PAY-RATE...
    02  FICA-RATE... 
    02  DEDUCTIONS...
01  PAYROLL-CHECK.
    02  EMPLOYEE-NUMBER.
        03  CLOCK-NUMBER...
        03  FILLER...
    02  DEDUCTIONS.
        03  FICA-RATE...
        03  WITHHOLDING-TAX...
        03  PERSONAL-LOANS...
    02  WAGES.
        03  HOURS-WORKED...
        03  PAY-RATE...
    02  NET-PAY...
    02  EMPLOYEE-NAME.
        03  SHIFT-CODE...

According to the rules for the CORRESPONDING phrase, the following subtractions take place:

1st operand

2nd operand

HOURS-WORKED OF WAGES OF EMPLOYEE-RECORDHOURS-WORKED OF WAGES OF PAYROLL-CHECK
PAY-RATE OF WAGES OF EMPLOYEE-RECORDPAY-RATE OF WAGES OF PAYROLL-CHECK

The following items are not subtracted, for the reasons stated:

Item

Reason

EMPLOYEE-NUMBER

Item not elementary item in either group

PLANT-LOCATION OF EMPLOYEE-NUMBER OF EMPLOYEE-RECORD

Name does not appear under PAYROLL-CHECK

CLOCK-NUMBER OF EMPLOYEE-NUMBER

Item is not elementary in one group

SHIFT-CODE OF CLOCK-NUMBER OF EMPLOYEE-NUMBER OF EMPLOYEE-RECORD

Qualification is not identical in PAYROLL-CHECK

CONTROL-NUMBER OF CLOCK-NUMBER OF EMPLOYEE-NUMBER OF EMPLOYEE-RECORD

Name does not appear under PAYROLL-CHECK

WAGES

Name is not elementary in either group

TAX-RATE OF EMPLOYEE-RECORD

Qualification is not identical in PAYROLL-CHECK

DEDUCTIONS

Item not elementary in one group