Library View Topics Framed Contents Revised Topics Previous Topic Next Topic Search Search ResultsPrevious Topic MatchNext Topic Match Notes List Notes Print Download No PDF Handheld DisconnectedHandheld ConnectedHelp

6.2.24 MOVE Statement



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__________|                                            |
   |                                                                        |
   |________________________________________________________________________|
identifier-1, literal-1
Sending area

identifier-2
Receiving area(s)

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 6.2.24.1 and "Group Moves" in topic 6.2.24.2.

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 6.1.8.1. The results are the same as if each pair of CORRESPONDING identifiers were referenced in a separate MOVE statement.


X Do not specify a data item defined with USAGE IS POINTER, USAGE IS
X PROCEDURE-POINTER, or USAGE IS OBJECT REFERENCE in a MOVE statement.


X A data item defined with USAGE IS POINTER, USAGE IS PROCEDURE-POINTER, or
X USAGE IS OBJECT REFERENCE can be part of a group that is referred to in a
X MOVE CORRESPONDING statement; however, no movement of the data item will
X take place.

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.

Subtopics:



Previous Topic Next Topic © Copyright IBM Corp. 1991, 1998

IBM Library Server Copyright 1989, 2005 IBM Corporation. All rights reserved.





Return to library:   z/OS | z/OS.e | TPF | z/VSE | z/VM | IBM Hardware | IBM System z Redbooks
Glossary:   IBM terminology
Publications:   How to order publications
Readers:   Download IBM Library Reader | Download IBM Softcopy Reader | Download Adobe® Acrobat® Reader®
Library management:   Download IBM Softcopy Librarian
Contacts:   Contact z/OS


Adobe, the Adobe logo, Acrobat, the Acrobat logo, and Acrobat Reader are registered trademarks of Adobe Systems incorporated.