Example of Move corresponding:
Consider the DATA DIVISION entries shown below.
Suppose it is needed that the data stored in the 4 fields of the PAY_REC should be moved to those fields of PRINT_REC which are given the similar data names. The following 4 MOVE statements can serve the aim.
MOVE ID-NUMBER OF PAY-REC TO ID-NUMBER OF PRINT-REC.
MOVE NAME OF PAY-REC TO NAME OF PRINT-REC.
MOVE DEPARTMENT OF PAY-REC T0 DEPARTMENT OF PRINT-REC.
MOVE BASIC-PAY OF PAY-REC TO BASIC-PAY OF PRINT-REC.
Though, as both the records have similar names for the concerned data items, the statement below
MOVE CORRESPODING PAY-REC TO PRINT-REC.
will have the similar effect. It is not essential that the corresponding data names in the two records must appear in similar order. The common format of the MOVE CORRESPONDING statement is
where the identifier-1 and identifier-2 should be group names. Note that the MOVECORRESPONDING is not a group move; it is just a means for specifying the number of elementary moves through a single MOVE statement. Any of the as such editing, if specified, will be performed. The Source and destination groups can involve data names which are not common. Only those fields having similar names in the two records will take part in the data movement. The left over data items in the destination group will stay unchanged.