Following the assembler program are examples of the program HLLPIPI
written in C, COBOL, and PL/I. HLLPIPI is called by an assembler program,
ASMPIPI. ASMPIPI uses the
Language Environment preinitialized
program subroutine call interface. You can use the assembler program
to call the HLL versions of HLLPIPI.
*COMPILATION UNIT: LEASMPIP
***********************************************************************
* *
* Function : CEEPIPI - Initialize the Preinit *
* environment, call a Preinit *
* HLL program, and terminate the environment. *
* *
* 1.Call CEEPIPI to initialize a subroutine environment. *
* 2.Call CEEPIPI to load and call a reentrant HLL subroutine. *
* 3.Call CEEPIPI to terminate the Preinit environment. *
* *
* Note: ASMPIPI is not reentrant. *
* *
***********************************************************************
*
* =====================================================================
* Standard program entry conventions.
* =====================================================================
ASMPIPI CSECT
STM R14,R12,12(R13) Save caller's registers
LR R12,R15 Get base address
USING ASMPIPI,R12 Identify base register
ST R13,SAVE+4 Back-chain the save area
LA R15,SAVE Get addr of this routine's save area
ST R15,8(R13) Forward-chain in caller's save area
LR R13,R15 R13 -> save area of this routine
*
* Load CEEPIPI service routine into main storage.
*
LOAD EP=CEEPIPI Load CEEPIPI routine dynamically
ST R0,PPRTNPTR Save the addr of CEEPIPI routine
*
* Initialize a Preinit subroutine environment.
*
INIT_ENV EQU *
LA R5,PPTBL Get address of Preinit Table
ST R5,@CEXPTBL Ceexptbl-addr -> Preinit Table
L R15,PPRTNPTR Get address of CEEPIPI routine
* Invoke CEEPIPI routine
CALL (15),(INITSUB,@CEXPTBL,@SRVRTNS,RUNTMOPT,TOKEN)
* Check return code:
LTR R2,R15 Is R15 = zero?
BZ CSUB Yes (success).. go to next section
* No (failure).. issue message
WTO 'ASMPIPI : call to (INIT_SUB) failed',ROUTCDE=11
C R2,=F'8' Check for partial initialization
BE TSUB Yes.. go do Preinit termination
* No.. issue message & quit
WTO 'ASMPIPI : INIT_SUB failure RC is not 8.',ROUTCDE=11
ABEND (R2),DUMP Abend with bad RC and dump memory
*
* Call the subroutine, which is loaded by LE
*
CSUB EQU *
L R15,PPRTNPTR Get address of CEEPIPI routine
CALL (15),(CALLSUB,PTBINDEX,TOKEN,PARMPTR, X
SUBRETC,SUBRSNC,SUBFBC) Invoke CEEPIPI routine
* Check return code:
LTR R2,R15 Is R15 = zero?
BZ TSUB Yes (success).. go to next section
* No (failure).. issue message & quit
WTO 'ASMPIPI : call to (CALL_SUB) failed',ROUTCDE=11
ABEND (R2),DUMP Abend with bad RC and dump memory
*
* Terminate the environment
*
TSUB EQU *
L R15,PPRTNPTR Get address of CEEPIPI routine
CALL (15),(TERM,TOKEN,ENV_RC) Invoke CEEPIPI routine
* Check return code:
LTR R2,R15 Is R15 = zero ?
BZ DONE Yes (success).. go to next section
* No (failure).. issue message & quit
WTO 'ASMPIPI : call to (TERM) failed',ROUTCDE=11
ABEND (R2),DUMP Abend with bad RC and dump memory
*
* Standard exit code.
*
DONE EQU *
LA R15,0 Passed return code for system
L R13,SAVE+4 Get address of caller's save area
L R14,12(R13) Reload caller's register 14
LM R0,R12,20(R13) Reload caller's registers 0-12
BR R14 Branch back to caller
*
* =====================================================================
* CONSTANTS and SAVE AREA.
* =====================================================================
SAVE DC 18F'0'
PPRTNPTR DS A Save the address of CEEPIPI routine
*
* Parameters passed to a (INIT_SUB) call.
*
INITSUB DC F'3' Function code to initialize for subr
@CEXPTBL DC A(PPTBL) Address of Preinit Table
@SRVRTNS DC A(0) Addr of service-rtns vector, 0 = none
RUNTMOPT DC CL255' ' Fixed length string of runtime optns
TOKEN DS F Unique value returned (output)
*
* Parameters passed to a (CALL_SUB) call.
*
CALLSUB DC F'4' Function code to call subroutine
PTBINDEX DC F'0' The row number of Preinit Table entry
PARMPTR DC A(0) Pointer to @PARMLIST or zero if none
SUBRETC DS F Subroutine return code (output)
SUBRSNC DS F Subroutine reason code (output)
SUBFBC DS 3F Subroutine feedback token (output)
*
* Parameters passed to a (TERM) call.
*
TERM DC F'5' Function code to terminate
ENV_RC DS F Environment return code (output)
*
* =====================================================================
* Preinit Table.
* =====================================================================
PPTBL CEEXPIT , Preinit Table with index
CEEXPITY HLLPIPI,0 0 = dynamically loaded routine
*
CEEXPITS , End of PreInit table
*
*
LTORG
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
END ASMPIPI