MOVEPTR
The MOVEPTR instruction is one way to attach a Pointer Definition to a Data Definition or Object variable. It uses one of the following formats:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
source1
Required. A previously defined Pointer or VAR variable that is moved to the {dest} Pointer Variable.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
dest1
Required. A previously defined Pointer or VAR variable that receives the value of the {source} variable.
source2
Required. A previously defined Pointer variable that is tested for a valid value.
dest2
Required. A previously defined Pointer or VAR variable that is detached from any previous variables or pointers.
Flags Affected: OVER
Note the following:
{source1} and {dest1} must be the same data type.
MOVEPTR makes {dest1} point to {source1}. If {source} is already attached to a variable by MOVEADDR or created with SMAKE, {dest} references the same variable as {source}.
Using format (1) and if {source1} does not point to a valid variable, the OVER Condition Flag is set and {dest1} is cleared. If {source1} is a pointer to a pointer, no testing of other levels of indirection is done. Only the value of {source1} is tested.
Format (2) tests a pointer's status. With this syntax only and in the case of pointers to pointers, all levels of indirection will be tested.
Format (3) detaches {dest2} from any previous variables or Pointers. Once unattached, {dest2} must be reattached by a MOVEADDR, MOVEPTR, or SMAKE instruction prior to being referenced. Failure to do so results in an execution format error (F04 if in a regular instruction and F02 if in a variable list of an instruction). If an unattached pointer is referenced in a variable list, indeterminate results may occur since the instruction processes the list variables up to the unattached pointer.
The VAR data type provides for a typeless operand.
Enhanced ARRAY processing is supported. However, the format (2) gives an indeterminate OVER flag state when the {source2} parameter is a multi-dimensioned ARRAY with a part index specified. Also, if the {source2} is a multi-dimensioned ARRAY with an index specified for every dimension, the OVER flag state is valid. In addition, if the {source2} is a single dimensioned ARRAY with or without having an index specified, the OVER flag is returned with the correct state value.
See Also: Example Code, System Interface Instructions
![]() |