z/OS MVS Programming: Extended Addressability Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


PC routine that receives control in AR mode

z/OS MVS Programming: Extended Addressability Guide
SA23-1394-00

After receiving control, the PC routine must establish addressability by loading a base register. The PC routine must also load an ALET of 0 into the AR that corresponds to the base register.

Addresses that the caller passes to the PC routine must be qualified by an ALET. Before using an ALET, the PC routine must check the ALET:
  • If the caller passes an ALET of 0, a space switch PC routine for which SASN=OLD has been specified must change the ALET to 1 before using it.
  • If the caller passes other ALETs, the PC routine must use them to qualify addresses that the caller has passed.
  • The PC routine must never use an ALET of 1 that the caller has passed. If a caller passes an ALET of 1, the PC routine might, for example, set an error return code and return to the caller.

Addressability to the latent parameter area is through the primary address space. When the PC routine receives control, general register 4 contains the address of the latent parameter area. Before referencing the latent parameter area, the PC routine must set AR 4 to a value of 0.

Before returning control to the user, the PC routine must do the following:
  • If there are parameters to pass, place the address of the parameters into general register 0 or 1 and the ALET the caller will use to address the data into the corresponding AR. Remember that the address of any data in the caller's address space is qualified by an ALET of 0 for the caller, but an ALET of 1 for the PC routine if SASN=OLD. When passing the ALET to qualify the address of data in the caller's address space, IBM® recommends that the PC routine pass an ALET of 0 rather than depending on the caller to change the ALET from 1 to 0.
  • If there is a return code, place it into general register 15.

To restore the caller's environment and return control, the PC routine must issue the PR instruction.

The following examples compare the linkage conventions for the basic PC (first example) to the conventions for the stacking PC (second example). Both the user program and the PC routine are in primary mode.

User PC Routine
⋮
*
* BASIC PC LINKAGE
*
STM    14,12,12(13)
ESAR   2
ST     2,16(,13)
L      2,PCNUMBER
PC     0(2)
L      2,16(,13)
SSAR   2
LM     2,12,28(13)
⋮
BALR   6,0
PCLINK STACK
⋮
PCLINK UNSTACK
PT     3,14
User PC Routine
 .
 .
*
* STACKING PC LINKAGE
*
L      14,PCNUMBER
PC     0(14)
 
 .
BALR   6,0
⋮
PR
If the PC routine is in AR mode, the following is an example of the instructions you can use to establish addressability:
BALR   6,0
USING  *,6
SLR    7,7
SAR    6,7

See Using access registers for information about being in AR mode and manipulating the contents of ARs.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014