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


Invoking a PC routine

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

The PC instruction gives control to a PC routine. The PC number determines the specific PC routine that receives control. The entry table entry that corresponds to the PC number defines the PC routine's location and environment. To return to the caller, a stacking PC routine issues the PR instruction; a basic PC routine issues the PT instruction.

Figure 1 shows the instruction sequence needed to invoke a stacking PC routine. The stacking PC automatically saves the user's environment. When the PC routine issues the PR instruction to return control to the caller, the system restores the caller's environment.
Note: Getting the LX sequence number and putting it in the high-order half of register 15 is necessary only for a reusable LXs, but it will not interfere with a non-reusable LX. For more information on reusable LXs, see Reassigning LXs when the LX reuse facility is enabled.
Figure 1. Calling sequence for a stacking PC routine
 .
 .
 USING PSA,0
 CALL  IEANTRT,(LEVEL,NAME,TOKEN,RETCODE)  OBTAIN SERVBLK ADDRESS
 CLC   RETCODE,=A(IEANT_OK)     CHECK RETURN CODE
 BNE   NOSERVIC                 IF NO TOKEN, SERVICES NOT AVAILABLE
 L     14,SERVBLKA
 USING SERVBLK,14               ACCESS SERVBLK
 LMH   15,15,SERV1LXSEQNO       GET LX SEQUENCE NUMBER AND PUT IN HIGH-ORDER
 *																  										HALF (BITS 0-31) OF REG 15
 L     14,SERV1PC               GET PC NUMBER
 DROP  14
 PC    0(14)                    ISSUE THE PC
 .
 .
 LEVEL    DC A(IEANT_SYSTEM_LEVEL)
 NAME     DC CL16'SERVBLK'
 TOKEN    DS 0CL16
 SERVBLK  DS 0F
 SERV1PC  DS F
 SERV1LXSEQNO  DS F RETCODE  DS F
          IEANTASM              INCLUDE NAME/TOKEN SERVICES         X
                                    ASSEMBLER DECLARATION STATEMENTS

Figure 2 shows the instruction sequence needed to invoke a basic PC routine. The calling program must save registers and its SASID before issuing the PC instruction. When the PC returns control, the caller must restore registers and the SASID.

Figure 2. Calling sequence for a basic PC routine
 .
 .
 STM   14,12,12(13)             SAVE REGISTERS
 ESAR  2                        SAVE CALLER'S SASID IN THE
 ST    2,16(,13)                REG 15 SLOT OF SAVEAREA
 USING PSA,0
 CALL  IEANTRT,(LEVEL,NAME,TOKEN,RETCODE)  OBTAIN SERVBLK ADDRESS
 CLC   RETCODE,=A(IEANT_OK)     CHECK RETURN CODE
 BNE   NOSERVIC                 IF NO TOKEN, SERVICES NOT AVAILABLE
 L     15,SERVBLKA
 USING SERVBLK,15               ACCESS SERVBLK
 L     2,SERV1PC                OBTAIN SERVICE1 PC NUMBER
 DROP  15
 PC    0(2)                     ISSUE THE PC
 L     14,12(,13)               RESTORE REG 14
 L     2,16(,13)                LOAD SAVED SASID
 SSAR  2                        RESTORE CALLER'S SASID
 LM    2,12,28(13)              RESTORE REGS 2-12
 .
 .
 LEVEL    DC A(IEANT_SYSTEM_LEVEL)
 NAME     DC CL16'SERVBLK'
 TOKEN    DS 0CL16
 SERVBLKA DS A
          DS XL12
 RETCODE  DS F
          IEANTASM              INCLUDE NAME/TOKEN SERVICES        X
                                    ASSEMBLER DECLARATION STATEMENTS

To make it easier for the user to invoke a PC routine, the service provider can provide a macro that generates the needed instruction sequence.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014