For both the set and display requests, the program displays the character at the specified location. For an invalid request, the program displays an error message. For all requests, the program then goes to process another statement.
LGOODINP EQU *
MVC M1A,VCARDA Address changed/displayed
MVC M1B,VCARDV Storage value
CLI M1B,X'00' If X'00' (untouched),
BNE LGOODIN1 * change to "?".
MVI M1B,C'?' *
LGOODIN1 LA R2,M1 R2 -> message to print
B LTELL Go tell user status
LINVFUNC LA R2,M2 Unknown function
B LTELL Go tell user status
LINVADDV LA R2,M3 Invalid address
B LTELL Go tell user status
LINVADDR LA R2,M4 Address out of range
LTELL EQU * R2 -> message to print
LA R4,L31B03 Return to L31B03 in 31-bit mode
LA R1,L24B03 Go to L24B03 in 24-bit mode
BSM R4,R1 R4 = A(X'80000000'+L31B03)
L24B03 PUT VSYSPRT,(R2) Print the message
BSM 0,R4 Return to 31-bit mode at next instr
L31B03 B LREAD Continue
* End-of-file on SYSIN, or "E" function requested.
* Save any changes (DIV SAVE). Then issue UNIDENTIFY, which internally
* issues UNMAP and UNIDENTIFY.
LCLOSE EQU *
CLI VSWUPDT,0 Any updates outstanding ?
BE LCLOSE1 * No -- skip SAVE
DIV SAVE,ID=VTOKEN Save any changes
LA R2,5 Error code from SAVE
LTR R15,R15 SAVE ok ?
BNZ LERROR * No -- quit
LCLOSE1 DIV UNIDENTIFY,ID=VTOKEN All done with object
LA R2,6 Error code from UNIDENTIFY
LTR R15,R15 UNIDENTIFY ok ?
BNZ LERROR * No -- quit
L R13,4(,R13) Unchain save areas and return
LM R14,R12,12(R13) *
SR R15,R15 *
BR R14 *
LERROR ABEND (R2),DUMP Take a dump