Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

HANDLE attribute

You can use the HANDLE attribute to declare a variable as a pointer to a structure type. Such a variable is called a handle.

Read syntax diagramSkip visual syntax diagram>>-HANDLE--+-structure-type-name---+---------------------------><
           '-(structure-type-name)-'
 
structure-type-name
Specifies the typed structure this handle points to.

Like defined structures, handles are strongly typed: they can only be assigned to or compared with handles for the same structure type. No arithmetic operations are permitted on handles.

You cannot use the ADDR built-in function to assign the address of a typed structure to a handle because the ADDR built-in function returns a pointer, and pointers cannot be assigned to handles. However, the HANDLE built-in function takes a typed structure as its argument and returns a handle to that type. In the following example, using the tm structure type defined on page ***, a handle is declared which locates the tm type and the address of Daterec is assigned to that handle.

dcl P_Daterec handle tm;
dcl Daterec type tm;

P_Daterec = handle(Daterec);

You can convert a handle to a pointer using the POINTERVALUE built-in function.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)