COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division Verbs
HP COBOL Manual for TNS/E Programs—520347-003
9-119
MOVE CORRESPONDING
MOVE CORRESPONDING
MOVE CORRESPONDING copies elements of one group to corresponding elements
of another group. Groups of data correspond if they have the same names and
qualifier names, beyond the group-names in the MOVE statement, and if they meet
restraints explained under CORRESPONDING Phrase.
PROCEDURE DIVISION.
BEGIN-PROCESSING.
MOVE ITEM-A TO TEMP1
* TEMP1 is set to "AAAA"
MOVE ITEM-A TO TEMP2
* TEMP2 is set to "AAAAA "
MOVE ITEM-B TO TEMP3
* TEMP3 is set to 00002v380
* where "v" marks the decimal location
MOVE ITEM-B TO TEMP4
* TEMP4 is set to 2v3
* where "v" marks the decimal location
MOVE SPACES TO RECORD-IN
* RECORD-IN is set to " "
* (9 spaces)
MOVE ZEROS TO ITEM-B
* ITEM-B is set to 00v00
* where "v" marks the decimal location
MOVE 5280 TO ITEM-C.
* ITEM-C is set to " 5,280.00"
MOVE ITEM-C TO TEMP-3.
* TEMP-3 is set to 05280v000
* where "v" marks the decimal location
MOVE ZEROS TO TEMP-5.
* Each 2-digit T in TEMP-5 is set to
* the 2-character value "00". Do not
* move ZEROS to any group containing
* COMP or NATIVE-n items, because the
* operation delivers characters.
* Do not move LOW-VALUES to a group
* of numeric items -- instead use
* INITIALIZE ...
* REPLACING NUMERIC DATA BY ZERO
Caution. MOVE CORRESPONDING is not recommended, because minor changes to one
group can change the correspondence between its elements and those of the other group, and
this is difficult to detect. If someone adds a new name to a group, the new name might be
included in unintended move operations.
Example 9-42. MOVE TO Statements (page 2 of 2)










