%ADDR returns a value of type basing pointer. The value is the
address of the specified variable. It may only be compared with and
assigned to items of type basing pointer.
%ADDR returns the address of the data portion of a variable-length
field when *DATA is specified as the second parameter of %ADDR.
If %ADDR with an array index parameter is specified as parameter
for definition specification keywords INZ or CONST, the array index
must be known at compile-time. The index must be either a numeric
literal or a numeric constant.
In an EVAL operation where the result of the assignment is an array
with no index, %ADDR on the right hand side of the assignment operator
has a different meaning depending on the argument for the %ADDR.
If the argument for %ADDR is an array name without an index and the
result is an array name, each element of the result array will contain
the address of the beginning of the argument array. If the argument
for %ADDR is an array name with an index of (*), then each element
of the result array will contain the address of the corresponding
element in the argument array. This is illustrated in Figure 1.
If the variable specified as parameter is a table, multiple occurrence
data structure, or subfield of a multiple occurrence data structure,
the address will be the address of the current table index or occurrence
number.
If the variable is based, %ADDR returns the value of the basing
pointer for the variable. If the variable is a subfield of a based
data structure, the value of %ADDR is the value of the basing pointer
plus the offset of the subfield.
If the variable is specified as a PARM of the *ENTRY PLIST, %ADDR
returns the address passed to the program by the caller.
When the argument of %ADDR cannot be modified, %ADDR
can only be used in a comparison operation. An example of an argument
that cannot be modified is a read-only reference parameter (CONST
keyword specified on the Procedure Interface).