Handles access members of a typed structure with the => operator. In the following example, given the tm type defined on page ***, the time is displayed using a handle to that type:
dcl P_Daterec handle tm; P_Daterec = handle(Daterec); display ( edit(P_Daterec=>tm_hours,'99') || ':' || edit(P_Daterec=>tm_min,'99') || ':' || edit(P_Daterec=>tm_sec,'99') );
Handles can locate any member in a typed structure, including the level-1 name (the type name itself). A reference by a handle to its type name constitutes a reference to the typed structure which is pointed to by that handle. This allows reference to this aggregate data by its handle. For example, given that H1 and H2 point to two allocated structures, you can swap two structures by:
define structure 1 T, 2 U, 2 V, 2 W; dcl (H1, H2) handle T; dcl Temp type T; Temp = H1=>T; H1=>T = H2=>T; H2=>T = Temp;