Previous Topic Next topic Print topic


Locator Qualified References

A reference to a based variable may be qualified by a reference to a pointer or offset variable. For example:

DECLARE A(10) FLOAT BASED; 
DECLARE P POINTER;

In this example, P –>A and P –>A(K) are pointer qualified references to the based variable A.

Since a pointer variable may itself be based, multiple qualification is possible. For example:

DECLARE     1 NODE BASED,
            2 NEXT POINTER, 
            2 VALUE FLOAT;
DECLARE HEAD POINTER;

In this example, HEAD –>NODE.NEXT–>NODE.VALUE is a pointer qualified reference to NODE.VALUE. It is qualified by NODE.NEXT, which is, in turn, qualified by HEAD.

Pointer-valued functions and pointer-valued built-in functions may also be used as pointer qualifiers.

DECLARE NEXT_NODE ENTRY RETURNS(POINTER);

In this example, NEXT_NODE() –>NODE.VALUE is a pointer qualified reference to NODE.VALUE whose qualifier is a function reference.

When addressing data allocated in an area, an offset variable can be used as a locator qualifier in the same fashion as the pointer is in the above examples. The offset value will be implicitly converted to a pointer value by adding the address of the area specified in the OFFSET attribute of its declaration.

Previous Topic Next topic Print topic