Documente Academic
Documente Profesional
Documente Cultură
|
*** MOVE STATEMENT ***
|
|
|
| The MOVE statement is a PROCEDURE DIVISION statement which transfers
|
| data from one area of storage to one or more other areas of storage.
|
|
|
|
Format 1
|
|
-------|
|
MOVE identifier1/literal1 TO identifier2
|
|
|
|
Format 2
|
|
-------|
|
MOVE CORRESPONDING/CORR identifier1 TO identifier2
|
|
|
|
|
| Identifier1/literal1 is the sending area.
|
|
|
| Identifier2 is the receiving area. It may specified as multiple data|
| items in Format 1 in order to specify multiple receiving areas.
|
|
|
| When Format 1 is used, all identifiers may be either elementary or
|
| group items. The data in identifier1/literal1 is moved into each
|
| receiving data item specified by identifier2 (in the order in which the
|
| receiving items are specified).
|
|
|
| When CORRESPONDING is specified (in Format 2), both identifier1 and
|
| identifier2 must be group items. In this case, selected items (i.e.,
|
| those with the same name) in identifier1 are moved to identifier2
|
| (i.e., according to the rules for the CORRESPONDING phrase).
|
|
|
| In Format 2 and in Format 1 when multiple receiving areas are
|
| specified, the results are the same as if multiple MOVE statements had
|
| been coded (i.e., one MOVE statement for each individual receiving data
|
| item).
|
|
|
| Evaluation of the length and evaluation of any subscripting associated
|
| with identifier1 is done only once, immediately before data is moved to
|
| the first of the receiving data items. Length and subscript evaluation
|
| for data items associated with identifier2 are done immediately before
|
| data is moved to the respective receiving data item.
|
|
|
| Evaluation of the length of sending or receiving area may be affected
|
| by the DEPENDING ON phrase of the OCCURS clause.
|
|
|
| A MOVE statement cannot reference an index data item, a pointer data
|
| item, or, for COBOL/370, a procedure-pointer data item.
|
|
|
|
ELEMENTARY MOVES
|
|
|
| An elementary move is one in which both the sending and receiving items
|
| are elementary items. In an elementary move, any necessary conversion
|
| of data from one internal form to another as well as any specified
|
| editing implied by the receiving item is done as part of the execution
|
| of the MOVE statement.
|
|
|
| Special considerations for elementary moves are outlined below. When
|
| the data category of the receiving field is:
|
|
|
|
ALPHABETIC
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
YES
YES
NO
NO
NO
NO
Alphanumeric and
Non-numeric
Literals
YES
YES
YES
YES
YES
NO
YES
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Alphanumeric-edited YES
YES
YES
NO
NO
NO
NO
|
|
|
| Numeric integer and NO
YES
YES
YES
YES
YES NO
|
| ZERO
|
|
|
| Numeric Non-integer NO
NO
NO
YES
YES
YES NO
|
| and numeric literals
|
|
|
| Numeric-Edited
NO
YES
YES
YES
YES
YES NO
|
|
|
| Floating-Point
NO
NO
NO
YES
YES
YES NO
|
|
|
| DBCS
NO
NO
NO
NO
NO
NO
YES
|
|
|
|
|
|
GROUP MOVES
|
|
|
| A group move is a move in which either the sending area, the receiving
|
| area, or both areas are group items.
|
|
|
| All group moves are valid. A group move is treated as though it were
|
| an alphanumeric elementary move except that no conversion of data takes
|
| place.
|
|
|
| For more information, see CORRESPONDING PHRASE, OCCURS CLAUSE, DATA
|
| CATEGORIES, JUSTIFIED CLAUSE, and WHEN-COMPILED.
|
|
|
| For the items defined below:
|
|
|
|
05 WS-ITEMA
PIC X(5)
VALUE 'ABCDE'.
|
|
05 WS-ITEMB
PIC X(3)
VALUE SPACES.
|
|
05 WS-ITEMC
PIC X(7)
VALUE 'XXXXXXX'.
|
|
05 WS-ITEMD
PIC 9(5)
VALUE 50.
|
|
05 WS-ITEME
PIC S9(5)V99 VALUE ZERO.
|
|
05 WS-ITEMF
PIC S9(5)V99 VALUE +100.
|
|
05 WS-ITEMG
PIC ZZ,ZZ9.99.
|
|
|
| The results of the following MOVE statements are shown to the right of
|
| the statement:
|
|
New Value In
|
|
Receiving Field
|
|
--------------|
|
|
|
MOVE WS-ITEMA TO WS-ITEMB.
'ABC'
|
|
|
|
MOVE WS-ITEMA TO WS-ITEMC.
'ABCDEbb' (b=space)
|
|
|
|
MOVE WS-ITEMD TO WS-ITEMA.
'00050'
|
|
|
|
MOVE WS-ITEMD TO WS-ITEME.
+50.00
|
|
|
|
MOVE WS-ITEMF TO WS-ITEMG.
'bbb100.00' (b=space)
|
|******************************* BOTTOM OF DATA *******************************|