Figure 1 is an example of a technique to have a 31 bit exit routine residing above the 16 MB line but with an entry point below the line. It is also an example of a glue routine.
The DCB, DCB exit list and entry point for an exit list must reside below the 16 MB line. The OPEN parameter list in this example must reside below the line.
BigProg AMODE 31 Execute in 31-bit addressing mode
BigProg RMODE ANY Reside above the 16 MB line
STORAGE OBTAIN,LENGTH=LenArea,LOC=(BELOW,64) Get DCB & etc. area
LR R2,R1 Load work area base register
USING WorkArea,R2
MVC MyDCB,ModelDCB Create DCB below the line
LA R0,EXL Point the DCB to exit list below
STCM R0,B'0111',DCBEXLSA-IHADCB+MyDCB the line
MVI EXL,X'85' Set last entry & DCB OPEN exit list
LA R0,OPEN24 Point the exit list to the exit rtn
STCM R0,B'0111',EXLOPEN that is below the line
MVC OPEN24,ModOPEN24 Move glue code to below line
LA R0,OPEN31 Show the 24-bit code where the
ST R0,AdOPEN31 31-bit code is above the line
OI AdOPEN31,X'80' Set bit 0 to AMODE 31 in address
MVC OpenList,ModelOPEN Build OPEN parameter list
OPEN (MyDCB),MF=(E,OpenList) List is below the line
.
.
BR R14 Return to caller
OPEN31 EQU * Entry point of DCB OPEN exit above the line
.
.
BSM 0,R14 Switch to 24-bit mode and return to OPEN
ModelOPEN OPEN (,INPUT),MF=L Model OPEN parameter list
LenOpen EQU *-ModelOPEN
* The following is the model for the DCB OPEN exit routine entry point.
* We copy this code to the work area, which is below the line. The
* BSM sets the current addressing mode (24) in bit 0 of R14 without
* changing anything else in R14. It also switches to 31-bit due to
* bit 0 in R15 and branches to the address in R15.
ModOPEN24 L R15,AdOPEN31-OPEN24(,R15) Entry pt to DCB OPEN exit rtn
BSM R14,R15 Save AMODE, switch to 31-bit and branch
LenOPEN24 EQU *-ModOPEN24
* DCB model, which is above the line.
ModelDCB DCB DSORG=PS,DDNAME=SYSIN,MACRF=(GL,PL)
*
* Dynamic storage that must reside below 16MB line due to DCB & exit
* list restrictions.
WorkArea DSECT
MyDCB DS XL(DCBLngQS) Actual QSAM DCB
* Each entry in DCB exit list is four bytes.
EXL DC X Last entry in exit list and for DCB OPEN exit
EXLOPEN DS AL3 Address of 24-bit DCB OPEN exit routine
OPENList DS XL(LenOpen) OPEN parameter list
* The following is executable code to branch above the 16 MB line.
OPEN24 DS XL(LenOPEN24) DCB OPEN exit below 16 MB line
AdOPEN31 DS A Address of DCB OPEN exit above the line
LenArea EQU *-WorkArea
DCBD DSORG=QS,DEVD=DA Mapping macro for DCB