Compaq AAQ2G1FTK Marine Radio User Manual


 
Handling Nonnumeric Data
3.6 Using the MOVE Statement
Table 3–4 Data Movement with the JUSTIFIED Clause
FIELD1
FIELD2
PICTURE
Character-String Contents
PICTURE
Character-String
(and JUST-Clause)
Contents After
MOVE
XX AB
XXXXX ABCss
XXX ABC XX JUST BC
XXXXX JUST ssABC
Legend: s = space
3.6.3 Multiple Receiving Items
If you write a MOVE statement containing more than one receiving item, the
compiler moves the same sending item value to each of the receiving items. It
has essentially the same effect as a series of separate MOVE statements, all with
the same sending item.
The receiving items need have no relationship to each other. The compiler
checks the validity of each one independently and performs an independent move
operation on each one.
Multiple receiving items on MOVE statements provide a convenient way to set
many items equal to the same value, such as during initialization code at the
beginning of a section of processing. For example:
MOVE SPACES TO LIST-LINE, EXCEPTION-LINE, NAME-FLD.
MOVE ZEROS TO EOL-FLAG, EXCEPT-FLAG, NAME-FLAG.
MOVE 1 TO COUNT-1, CHAR-PTR, CURSOR.
3.6.4 Subscripted Moves
Any item (other than a data item that is not subordinate to an OCCURS clause)
of a MOVE statement can be subscripted, and the referenced item can be used to
subscript another name in the same statement.
For example, when more than one receiving item is named in the same MOVE
statement, the order in which the compiler evaluates the subscripts affects the
results of the move. Consider the following examples:
MOVE FIELD1(FIELD2) TO FIELD2 FIELD3.
In this example, the compiler evaluates FIELD1(FIELD2) only once, before it
moves any data to the receiving items. It is as if the single MOVE statement
were replaced with the following three statements:
MOVE FIELD1(FIELD2) TO TEMP.
MOVE TEMP TO FIELD2.
MOVE TEMP TO FIELD3.
3–10 Handling Nonnumeric Data