MOVE Corresponding


The MOVE corresponding is a group move but the elementary items of sending group item should match with elementary items of receiving item. MOVE CORRESPONDING only affects data-items that are having identical names in both sending and receiving group items.

MOVE CORRESPONDING doesn't affect the elementary items in the sending or receiving records which are not matching. MOVE CORRESPONDING automatically searches for the corresponding elementary items to move the data from sending item to receiving item.

Sending item in MOVE statement can be an alphanumeric group item. Receiving item in MOVE statement should be an alphanumeric group item but not literal or a figurative constant.

Syntax -


MOVE CORRESPONDING Syntax

Parameters -


identifier-1 - Specifies sending area.

identifier-2 - Specifies receiving areas. All identifiers can reference alphabetic or numeric or alphanumeric group items.

Practical Example -


Code -

MOVE Corresponding Program Code

In the above example, FULL-NAME declared as of length 30 with three elementary items FIRST-NAME, MIDDLE-NAME and LAST-NAME of length 10 each.

Similarly FULL-NAME-REV is declared with same length 30 with three elementary items in the order LAST-NAME, MIDDLE-NAME and FIRST-NAME of length 10 which are the reverse order of FIRST-NAME.

The input is accepted from SYSIN for the three elementary items.

After all ACCEPT statements executed, the values of elementary items will be

FIRST-NAME will have MAINFRAMES
MIDDLE-NAME will have TECH
LAST-NAME will have HELP

To move the elementary items to another group item, we need three simple move statements.

This one can be accomplished by using a CORRESPONDING MOVE likes below -

MOVE CORRESPONDING FULL-NAME TO FULL-NAME-REV.

The above move statement will do the below tasks

  1. Moving FIRST-NAME of FULL-NAME to FIRST-NAME of FULL-NAME-REV
  2. Moving MIDDLE-NAME of FULL-NAME to MIDDLE-NAME of FULL-NAME-REV
  3. Moving LAST-NAME of FULL-NAME to LAST-NAME of FULL-NAME-REV

JCL -

MOVE Corresponding Jcl

Output -

MOVE Corresponding Output