For compatibility reasons, the old subprogram interface described here is still supported.
The new subprogram interface is described in the manual “LMS Subroutine Interface” [1 (Related publications)].
If LMS is called as a subprogram with independent dialog, control is returned to the program that issued the call after the END statement is processed. LMS remains loaded after the END statement is processed. In all other respects, the LMS run is the same as when the program is loaded by means of the /START-EXECUTABLE-PROGRAM command. Whenever LMS is called, it logs on its own STXIT routine.
When control is returned to the main program, LMS’s STXIT routine is logged off; the main program must then log its own STXIT routine on again.
When calling the subprogram interface, be sure to observe the following register conventions:
Register 1 Register 13 | must be zero. contains the address of an 18-word save area which must be made |
Register 14 Register 15 | contains the return address. contains the entry address LMSUPSDF. |
Before control is returned to the calling program, LMS stores the following return codes in register 15:
X'00' X'04' | LMS terminated normally. LMS terminated abnormally. |
Example
LMS is called as a subprogram from the program UPROG. In LMS, a member is output from a program library to a file. After the LMS run has terminated, control is returned to the user program.
/START-LMS //OPEN UEB.BIB,U ------------------------------------------------------------------ (1) //SHOW-ELEM *LIB(,LMSCALL,S) ------------------------------------------------------ (2) INPUT LIBRARY= :N:$USER.UEB.BIB,DEV=DISK INPUT ELEMENT= (S)LMSCALL/(0001)/1995-08-12 UPROG START BALR 3,0 USING *,3 MVC OUTPUT,ANMELD AUFRUF WROUT OUT,TERM LA 14,RUECK ----------------------------------------------------------- (3) LA 1,0 ---------------------------------------------------------------- (4) LA 13,SAVE ------------------------------------------------------------ (5) L 15,=V(LMSUPSDF) ---------------------------------------------------- (6) BALR 14,15 RUECK MVC OUTPUT,ABMELD WROUT OUT,TERM * * TERM TERM * * SAVE DS 18F * ANMELD DC '********** *LMS ACTIVATED NOW ************' ABMELD DC '***** LMS TERMINATED NOW - RETURNING TO PROGRAM *****' OUT DC Y(ENDE-OUT) DS CL2 DC X'01' OUTPUT DS CL50 ENDE EQU * * * END UPROG NUMBER OF PROCESSED RECORDS IS 29 //END / . . . /START-EXECUTABLE-PROGRAM FROM-FILE=(LIB=UEB.BIB,ELEM=LMSCALL) % BLS0500 PROGRAM 'LMSCALL', VERSION '007' OF '95-08-12' LOADED ********** *LMS ACTIVATED NOW ************ % LMS0310 LMS VERSION ́03.4B00 ́ STARTED ------------------------------------------ (7)
//OPEN UEB.BIB,U //SHOW-E-ATTR INPUT LIBRARY= :N:$USER.UEB.BIB,DEV=DISK TYP NAME VER (VAR#) DATE (C) LMSCALL 007 (0001) 1995-08-12 1 (C)-ELEMENT(S) IN THIS TABLE OF CONTENTS //EXTRACT-ELEM *LIB(,LMSCALL,S),LMSCALL1 INPUT LIBRARY= :N:$USER.UEB.BIB,DUF2EV=DISK OUTPUT FILE SEL (S)LMSCALL/(0001)/1995-08-12 AS LMSCALL1 //END ---------------------------------------------------------------------------- (8) % LMS0311 LMS VERSION ́03.4B00 ́ TERMINATED NORMALLY ***** LMS TERMINATED - RETURNING TO PROGRAM *****
(1) | The program library UEB.BIB is designated as the input and output library. |
(2) | The source program LMSCALL is listed. |
(3) | The return address is loaded in register 14. |
(4) | Register 1 is set to 0. |
(5) | The address of the save area is loaded in register 13. |
(6) | The entry address LMSUPSDF is loaded in register 15. |
(7) | LMS is called from within the user program. |
(8) | Following termination of the LMS run, control is returned to the user program. |