COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-129
MOVE TO
•
MOVE Conventions
Table 9-3 summarizes the legal MOVE TO statements by category of sending and
receiving data items. Data is converted and stored according to the category of the
receiving data item.
•
Alphabetic, Alphanumeric, Alphanumeric Edited, or National Receiving Data Items
Data is stored beginning at the leftmost position of receiver. If sender is
shorter than receiver, spaces are filled according to standard alignment rules. If
sender is longer than receiver, the value of sender is truncated on the right
to the length of receiver. Any editing required by receiver is performed
unless sender is a group data item.
If sender is a signed numeric data item, the operational sign is not moved to
receiver. If sender is described with the SEPARATE phrase in the SIGN clause,
the size of sender is considered to be one character less than the actual size of
sender.
If sender is a numeric item with the scaling factor (P ) in its rightmost digits,
positions containing P are considered to contain zeros.
If sender is a numeric item with decimal digits (that is, sender has V in its
PICTURE clause), the decimal point is ignored and sender is treated as if it were
an alphanumeric item whose size is equal to the number of 9 s in the PICTURE
clause. If its USAGE is not DISPLAY, it is converted to DISPLAY for the move
operation. For example:
PIC 999V99 VALUE 123.45
is treated as if it were PIC X(5); that is, as the value 12345.
If the number of digits in sender is greater than 18 (for example, when a
NUMVAL function is used), the leftmost 18 digits are moved and any to the right of
this are discarded.
Table 9-3. Summary of Legal Moves
Category of Sending Data Item
Category of Receiving Data Item
Alphabetic Alphanumeric Numeric National
Alphabetic Yes Yes No No
Alphanumeric Edited Yes Yes* No No
Non-Edited Yes Yes Yes No
Numeric Integer No Yes Yes No
Noninteger No Yes Yes No
Edited No Yes Yes No
National No No No Yes
* Although it is possible to move an alphanumeric item to a numeric item, the presence of a nonnumeric
character in the data moved makes any operation on the numeric item unpredictable.