The MOVE statement transfers data from one area of storage to one or more other areas.
___ Format 1 ___________________________________________________________ | | | <______________ | | >>__MOVE__ _identifier-1_ __TO____identifier-2_|____________________>< | | |_literal-1____| | | | |________________________________________________________________________|
___ Format 2 ___________________________________________________________ | | | >>__MOVE__ _CORRESPONDING_ __identifier-1__TO__identifier-2_________>< | | |_CORR__________| | | | |________________________________________________________________________|
When Format 1 is specified, all identifiers can be either group or elementary items. The data in the sending area is moved into the data item referenced by each identifier-2 in the order in which it is specified. See "Elementary Moves" in topic 184.108.40.206 and "Group Moves" in topic 220.127.116.11.
When Format 2 is specified, both identifiers must be group items. CORR is an abbreviation for, and is equivalent to, CORRESPONDING.
When CORRESPONDING is specified, selected items in identifier-1 are moved to identifier-2, according to the rules for the CORRESPONDING phrase on in topic 18.104.22.168. The results are the same as if each pair of CORRESPONDING identifiers were referenced in a separate MOVE statement.
An index data item cannot be specified in a MOVE statement.
The evaluation of the length of the sending or receiving area can be affected by the DEPENDING ON phrase of the OCCURS clause (see "OCCURS Clause" in topic 5.3.10).
If the sending field (identifier-1) is reference-modified, subscripted, or is an alphanumeric or alphabetic function-identifier, the reference-modifier, subscript, or function is evaluated only once, immediately before data is moved to the first of the receiving operands.
Any length evaluation, subscripting, or reference-modification associated with a receiving field (identifier-2) is evaluated immediately before the data is moved into that receiving field.
For example, the result of the statement:
MOVE A(B) TO B, C(B).is equivalent to:
MOVE A(B) TO TEMP MOVE TEMP TO B. MOVE TEMP TO C(B).where TEMP is defined as an intermediate result item. The subscript B has changed in value between the time that the first move took place and the time that the final move to C(B) is executed.
For further information on intermediate results, see the IBM COBOL Programming Guide for your platform.
After execution of a MOVE statement, the sending field(s) contain the same data as before execution.
Note: Overlapping operands in a MOVE statement can cause unpredictable results.
Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.