gtpg2m5d | General Macros |
This general macro defines and generates the code and tables that are necessary to support the use of a user exit by multiple functions.
Format
|
Entry Requirements
None.
Return Conditions
None.
Programming Considerations
Examples
UCCUEX1 DS 0H UXMAC START,EXIT=UEX1,PARMS=R2,WKAREA=12 ST R2,UEX1_WKA Save callers R2 $GSWBC BLOCK=R2,SAVREG=(R0,R1) Get additional work area ST R2,UEX1_WKA+4 Save the address of the SWB MVC 0(4,R2),ENTN_WKA Pass SWB and R2 value to functions * * Now call all of the functions defined for UEX1. * UXMAC BUILD,NAME=IUX_UF1,ROUTINE=CPUF1,TYPE=INT,RCRTN=UF1_RC, X RCTYPE=INT UXMAC BUILD,NAME=IUX_UF2,ROUTINE=CPUF2,TYPE=EXT * * The functions have all been called, get rid of the SWB and pass the * return code back to the caller. * L R1,ENTN_WKA+4 Get address of SWB $RSWBC BLOCK=R1 Release SWB L R2,ENTN_WKA+8 Load return code from UF1_RC UXMAC END . . . UF1_RC DS 0H Process return code USING *,R15 SLNKC LOREG=NO,PUSH=NO ST R2,ENTN_WKA+8 Save return code RLNKC LOREG=NO,POP=NO LTORG DROP R15
The previous macro calls will generate the following stub routine:
UCCUEX1 DS 0H + USING UCCUEX1,R15 register for this routine + SLNKC PUSH=YES,DSECT=UEX1,LOREG=R0 +UEX1_INL14 DS F Save area for callers R14 +UEX1_UREGS DS 4F User register save area +UEX1_CREGS DS 2F UXMAC register save area +UEX1R2 DS F Save area for PARMS register +UEX1_WKA DS XL12 User work area + DLNKC + MVC UEX1_INL14,UEX1LEN+STKINL14(R13) Save callers R14 ST R2,UEX1_WKA Save callers R2 $GSWBC BLOCK=R2,SAVREG=(R0,R1) Get additional work area ST R2,ENTN_WKA+4 Save the address of the SWB MVC 0(4,R2),ENTN_WKA Pass SWB and R2 value to functions + STM R0,R3,UEX1_UREGS Save user registers + L R2,=V(UCLFUNI) Load base of UCL fun inds + LA R3,UCLEQUEX1 Load exit point index + MH R3,=Y(L'UCLFUNI) Get fun ind. displacement + AR R2,R3 Add to UCL fun base entry + L R3,CNT_UEX1 Load count of functions + MH R3,FSZ_UEX1+2 X size = displacement +CK_UEX1 DS 0H + L R0,0(,R2) Load multi-function bits + L R1,4(,R2) Load multi-function bits + L R14,FUNI_UEX1+0(R3) Load bit position + SLDL R0,0(R14) Move bit to position 0-R0 + LTR R0,R0 Is this function active? + BNM NXT_UEX1 No, go check next function + L R14,FUNA_UEX1+0(R3) Load routine address + STM R2,R3,UEX1_CREGS Save UXMAC control registers + LM R0,R3,UEX1_UREGS Restore user registers + MVC STKINL14(,R13),UEX1_INL14 Set up callers R14 for exit + CLNKC BASE=R15,LINK=R14,RTN=(R14) Call user function + L R14,UEX1_CREGS+4 Load function pointer + L R14,FUNR_UEX1+0(R14) Load addr of return code routine + LTR R14,R14 Is there a return code routine? + BZ SK_UEX1 No, continue + CLNKC BASE=R15,LINK=R14,RTN=(R14) Call return code routine +SK_UEX1 DS 0H + LM R2,R3,UEX1_CREGS Restore UXMAC work registers +NXT_UEX1 DS 0H + SL R3,FSZ_UEX1 Point to next function + BNM CK_UEX1 Go if more functions to check L R1,UEX1_WKA+4 Get address of SWB $RSWBC BLOCK=R1 Release SWB L R2,UEX1_WKA+8 Load return code from UF1_RC + RLNKC POP=YES,LOREG=R0,PARMS=R2 +* +* +CNT_UEX1 DC F'1' Count of functions minus 1 +FSZ_UEX1 DC F'12' Function table entry size +* +FUNT_UEX1 DS 0F Function table +FUNA_UEX1 EQU FUNT_UEX1,4 Function address +FUNR_UEX1 EQU FUNA_UEX1+4,4 Return code routine address +FUNI_UEX1 EQU FUNR_UEX1+4,4 Function indicator +* +* Each entry in the function table is three words in length. The * +* first word contains the address of the routine that services the * +* function. The second word contains the address of the routine * +* that services the return code returned from the function. The * +* third word contains the function indicator bit. * +* + DC V(CPUF2) Address of function + DC A(0) + DC A(IUX_UF2) Function indicator bit +* + DC A(CPUF1) Address of function + DC A(UF1_RC) Address of return code routine + DC A(IUX_UF1) Function indicator bit
. . DCTUCL CALL UCL EQUATES UX1PL DSECT FOR PARAMETER LIST LA R1,CT99_WORK ADDRESS UX1PL WORK AREA USING UX1PL,R1 MVI UX1COD,UX1ACT SET ACTIVATE REQUEST MVI UX1PLF,UX1NEW SET NEW LIST FORMAT MVC UX1CNT,=H'2' SET COUNT OF LIST ENTRIES MVC UX1IDX,=AL2(UCLEQUEX1) SET INDEX FOR 'UEX1' EXIT UXMAC SET,NAME=IUX_UF1,WKREG=R2 SET UF1 FUNCTION ON UXMAC SET,NAME=IUX_UF2,WKREG=R2 SET UF2 FUNCTION ON UXCMC WKREG=R2 ACTIVATE 'UEX1' EXIT AND FUNCTIONS . .