Anchor considerations

ATTACH processing obtains a doubleword containing the address of the anchor vector in writable storage and initializes it to zero. In addition, the field at TCB+X'144' is initialized to point to this doubleword.

z/OS extends the size of the GETMAINed storage area by a doubleword used for the program's initial register save area. Note that the fullword for the service routine vector address is contained within the user's private space.

During Language Environment initialization, a Language Environment anchor vector is GETMAINed and initialized. The address of the GETMAINed anchor vector is placed into the first fullword provided by z/OS. The code shown in Figure 1 is an example of the Language Environment anchor vector code used to set and obtain the Language Environment anchor. Language Environment saves the anchor value directly within the Language Environment anchor vector. At offset X'08' is a pointer to the fullword where the CAA address is saved. This does not occur under other systems/subsystems.

Figure 1. Example of code to set and obtain the Language Environment anchor
ANCHOR   CSECT
         DC  A(GETCAA)       A(Obtain the Current CAA Addr)
         DC  A(SETCAA)       A(Set the current CAA Addr)
         DC  A(CAA)          Pointer to the saved CAA address
         DC  A(0)            Reserved
************************************************************
*   Obtain the current CAA Pointer                         *
************************************************************
GETCAA   DS  0H
         L   12,CAA-GETCAA(12)    Get the anchor into R12
         BR  14                   Return to the caller
************************************************************
*   Set the current CAA Pointer                            *
************************************************************
SETCAA   DS  0D
         ST  12,CAA-SETCAA(15)    Save/clear the anchor
         BR  14                   Return to the caller
************************************************************
*   Misc writable storage                                 *
************************************************************
CAA      DC  A(0)                 Spot to save the anchor
         DS  0D
SIZE     EQU *-ANCHOR
         END