Setting a Basing Pointer
Setting a Basing Pointer
You set or change the location of the based variable by setting or changing the basing pointer in one of the following ways:
-
Initializing with INZ(%ADDR(FLD)) where FLD is a non-based variable
-
Assigning the pointer to the result of %ADDR(X) where X is any variable
-
Assigning the pointer to the value of another pointer
-
Using ALLOC or REALLOC (see ALLOC (Allocate Storage), REALLOC (Reallocate Storage with New Length), and the Rational® Development Studio for i: ILE RPG Programmer’s Guide for examples)
-
Moving the pointer forward or backward in storage using pointer arithmetic:
EVAL PTR = PTR + offset(“offset” is the distance in bytes that the pointer is moved)