ADDR Function

Purpose

Returns a pointer to the storage referenced by the specified variable.

Syntax

ADDR(x)

Parameters

x is a specified variable.

Description

The ADDR function returns a pointer to the storage referenced by a specified variable x. If x is an unconnected array cross-section, ADDR returns the address of the first element of the first element of the cross-section.

x must not be a reference to a parameter whose corresponding argument was passed by value.

Examples

DECLARE ELEMENT FIXED BINARY BASED;
DECLARE A(10) FIXED BINARY;
DECLARE P POINTER;
   P = ADDR (A(5));   /* ADDRESS OF 5TH ELEMENT */
   P -> ELEMENT = -1;

Restrictions

On many implementations, x must not be an unaligned bit string or a structure consisting entirely of unaligned bit strings. (For information on this implementation, see your Open PL/I User's Guide.)