The MOVE statement transfers data, in accordance with the rules of editing, to one or more data areas.
If identifier-1 is reference modified, subscripted, or is a function-identifier,
the reference modifier, subscript, or function-identifier is evaluated only
once, immediately before data is moved to the first of the receiving operands.
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 an intermediate result item provided by your COBOL system.
national, national-edited
or floating-point.
These categories are described in the PICTURE clause. Numeric literals belong to the category numeric, and nonnumeric literals belong to the category alphanumeric. The figurative constant ZERO belongs to the category numeric when moved to a numeric or numeric-edited item. The figurative constant ZERO belongs to the category alphanumeric in all other cases. The figurative constant SPACE belongs to the category alphabetic. All other figurative constants belong to the category alphanumeric.
The following rules apply to an elementary move between these categories:
This restriction is removed.
, or de-editing implied by,
the receiving data item:
When the sending operand is numeric-edited, de-editing is implied to establish
the operand's unedited numeric value, which can be signed; then the unedited
numeric value is moved to the receiving field. The effect of de-editing depends
on the setting of the DE-EDIT Compiler directive
When a signed numeric item is the receiving item, the sign of the sending item is placed in the receiving item. (See the topic The SIGN Clause.) Conversion of the representation of the sign takes place as necessary. If the sending item is unsigned, a positive sign is generated for the receiving item.
When an unsigned numeric item is the receiving item, the absolute value of the sending item is moved and no operational sign is generated for the receiving item.
When a data item described as alphanumeric is the sending item, data is moved as if the sending item were described as an unsigned numeric integer.
When the receiving item is numeric or numeric-edited and the sending item is defined as alphanumeric, if the content of the sending item is not an integer, the results of the move are undefined. If the alphanumeric sending item is a literal whose contents do not represent an integer, an error is reported, and zero moved to the target. (See the topic Incompatible Data in the chapter Procedure Division.)
When the numeric data item is the sending item the action of the move is
such that a reverse of the move would cause the same value to appear in the
numeric-edited field (except for truncation). If the data item contains data
which does not conform to the edited picture, zero is moved to the target.
When the receiving field is national the sending item must be DBCS or national;
no conversion takes place. If the sending and receiving items are not the
same size the data item is either truncated or padded with national spaces
on the right.
The process is repeated for each destination group.
1 | The relevant rule number is quoted in these columns |
2 | An error is reported if a non-integer alphanumeric literal sending item is used |