MOVE Instructions


 

The MOVE instruction transfers the contents of the source operand to the destination operand. The contents of the source operand remain unchanged. The instruction uses the following format:

 

 

 

MOVE

{source}{sep}{dest}

 

Enhanced array processing is supported with the MOVE instruction. Consider the following examples that are applicable to all MOVE examples in this chapter.

 

ARR1

DIM

4(5)

ARR2

DIM

5(5)

 

MOVE

ARR1,ARR2

 

This would move all array elements from ARR1 to their corresponding elements in ARR2.

 

ARR1

DIM

4(5)

 

MOVE

"abc",ARR1

 

This would move 'abc' to all array elements in ARR1.

 

Arithmetic expressions are also supported in the MOVE instruction. If arithmetic expressions are used, the destination operand must be Numeric Variable. The arithmetic expression must also be enclosed in parentheses.

 

FAR

FORM

3

CEL

FORM

3

 

MOVE

( CEL * 1.8 + 32 ) TO FAR

 

This would calculate the Fahrenheit temperature from the Celsius temperature.

 

The MOVE instruction also supports RECORDS. The MOVE must be performed between two identically defined records. The contents of each member in the source record is moved to the corresponding member in the destination.

 

MOVE operations are allowed between RECORD POINTERs and VARLIST or VARLIST pointers (9.6A). Since a RECORD pointer actually contains the address of a varlist of the members of a RECORD, a member to member MOVE operation of every variable in the source and destination variable lists is done. RECORD pointers can be used for both the source and destination operands of a MOVE instruction.

Example:

 

Rec1List

LIST

 

Rec1

RECORD

 

A

DIM

5

B

DIM

5

 

RECORDEND

 

 

LISTEND

 

.

 

 

Rec1Ptr

RECORD

^,Rec1

.

 

 

Rec2List

LIST

 

Rec2

RECORD

 

X

DIM

5

Y

DIM

5

 

RECORDEND

 

 

LISTEND

 

.

 

 

Rec2Ptr

RECORD

^,Rec2

.

 

 

.All the following are allowed

.

 

 

 

MOVE

Rec1List,Rec2List

 

MOVE

Rec1Ptr,Rec2Ptr

 

MOVE

Rec1Ptr,Rec2List

 

MOVE

Rec1List,Rec2Ptr

 

 

The following topics contain specific information regarding the MOVE instruction:

 

MOVE - Character String to Character String

MOVE - Character String to Numeric Field

MOVE - Character String to Integer

MOVE - Numeric Field to Character String

MOVE - Numeric Field to Numeric Field

MOVE - Numeric Field to Integer

MOVE - Integer to Character String

MOVE - Integer to Numeric Field

MOVE - Integer to Integer

MOVE - Arithmetic Expression to Numeric Field

MOVE - Variable or Expression to Multiple Variables or Lists

MOVE - RECORD to RECORD

MOVE - VARLIST to VARLIST

MOVE - OBJECT to OBJECT

MOVELIST - RECORD\VARLIST to RECORD\VARLIST

 

 



PL/B Language Reference MOVE - Character String to Character String