ERM TITLE 'DMKERM (CP) VM/370 - RELEASE 6' 00001000
ISEQ 73,80 VALIDATE SEQUENCING OF SYSIN @V200020 00002000
COPY OPTIONS 00003000
COPY LOCAL 00004000
*. 00005000
* MODULE NAME - 00006000
* 00007000
* DMKERM - 00008000
* 00009000
* FUNCTION - 00010000
* 00011000
* TO LOCATE THE REQUESTED MESSAGE AND INSERT THE MODULE ID, 00012000
* MESSAGE NUMBER, AND DATA IF ANY AND PRINT THE MESSAGE 00013000
* 00014000
* ATTRIBUTES - 00015000
* 00016000
* REENTRANT, PAGEABLE, CALLED VIA SVC 00017500
* 00018000
* ENTRY POINTS - 00019000
* 00020000
* DMKERMSG - 00021000
* 00022000
* ENTRY CONDITIONS - 00023000
* 00024000
* GPR0 = XXXXXXNN 00025000
* 00026000
* XXXXXX IS THE 3 CHARACTER MODULE NAME. 00027000
* 00028000
* NN IS THE LENGTH IN BYTES OF THE DATA TO BE INSERTED 00029000
* INTO THE MESSAGE TEXT. 00030000
* IF NN IS ZERO, THE DATA IS CONTAINED IN GPR1. 00031000
* THE LENGTH OF THE DATA CANNOT EXCEED 00032000
* 120 MINUS THE TEXT-LENGTH 00033000
* 00034000
* GPR1 = ADDRESS OF DATA OR CONTAINS THE DATA 00035000
* 00036000
* IF GPR1 IS ZERO, NO DATA IS BEING PASSED FOR 00037000
* THE MESSAGE. 00038000
* 00039000
* IF GPR0-NN IS NON-ZERO, GPR1 CONTAINS THE ADDRESS 00040000
* OF THE DATA TO BE INSERTED IN THE MESSAGE. 00041000
* 00042000
* IF GPR0-NN IS ZERO, THE CONTENTS OF GPR1 IS STORED 00043000
* IN THE MESSAGE. 00044000
* 00045000
* SEE ALSO NOTES (BELOW). 00046000
EJECT 00047000
* ENTRY CONDITIONS (CONTINUED) - 00048000
* 00049000
* GPR2 = YYZZMMMM 00050000
* 00051000
* YY = X'80' AT EXIT RETURN TO CALLER, OTHERWISE ISSUE 00052000
* SVC 16 AND RETURN TO CALLER'S CALLER 00053000
* 00054000
* YY = X'40' CALLER HAS AREA TO BE FRET'D (SEE GPR3) 00055000
* 00056000
* YY = X'20' OPERATOR PARM FIELD ON MESSAGE WRITE 00057000
* 00058000
* YY = X'10' ALARM PARM FIELD ON MESSAGE WRITE 00059000
* 00060000
* YY = X'08' DELETE ERRMSG PARM FIELD ON MESSAGE WRITE 00061000
* 00062000
* ZZ = ACTION CHARACTER - DEFAULT CHARACTER IS 'E' 00063000
* 'I' = INFORMATION TYPE MESSAGE 00064000
* 'A' = ACTION TYPE MESSAGE 00065000
* 'R' = RESPONSE NEEDED BY OPERATOR 00066000
* 'W' = WARNING TYPE MESSAGE 00067000
* 'S' = SEVERE SYSTEM ERROR MESSAGE 00068000
* 00069000
* MMMM BINARY VALUE OF THE MESSAGE NUMBER 00070000
* AND RETURN CODE 00071000
* 00072000
* GPR3 = IMMATERIAL, OR = LENGTH & ADDRESS OF AREA TO BE FRET'D 00073000
* SEE GPR2 ABOVE; IF AN AREA IS TO BE FRET'D, 00074000
* GPR3 MUST = NNAAAAAA, WHERE 00075000
* NN = NUMBER OF DOUBLE WORDS, AND 00076000
* AAAAAA = ADDRESS OF AREA TO BE FRET'D 00077000
* 00078000
* GPR11 ADDRESS OF USER'S VMBLOK 00079000
* GPR12 ENTRY POINT ADDRESS 00080000
* GPR13 ADDRESS OF STANDARD SAVE AREA 00081000
* 00082000
* EXIT CONDITIONS - 00083000
* 00084000
* NONE 00085000
* 00086000
* CALLS TO OTHER ROUTINES - 00087000
* 00088000
* DMKFREE - OBTAIN FREE STORAGE FOR MESSAGE 00089000
* DMKFRET - RETURN FREE STORAGE IF REQUESTED BY CALLER 00090000
* DMKQCNWT - WRITE MESSAGE TO USER (OR SYSTEM OPERATOR) 00091000
* DMKCVTBD - TO CONVERT MESSAGE CODE FOR OUTPUT 00092000
* 00093000
* EXTERNAL REFERENCES - 00094000
* 00095000
* DMKSYSRM - TO REFERENCE REAL MACHINE SIZE 00096000
* DMKEMA00 - CANNED MESSAGES 000 - 139 00097100
* DMKEMB00 - CANNED MESSAGES 140 - 423 00097200
* DMKEMC00 - CANNED MESSAGES 424 - 00097300
* 00099000
* TABLES / WORK AREAS 00100000
* 00101000
* NONE 00102000
EJECT 00103000
* REGISTER USAGE - 00104000
* 00105000
* GPR7 = MESSAGE TEXT ADDRESS 00106000
* GPR8 = MESSAGE OUTPUT DATA ADDRESS 00107000
* GPR11 = ADDRESS OF USERS VMBLOK 00108000
* GPR12 = BASE ADDRESS 00109000
* GPR13 = ADDRESS OF STANDARD SAVEAREA 00110000
* 00111000
* OTHER REGISTERS ARE USED FOR WORK REGISTERS 00112000
* NOTES - 00113000
* 00114000
* IF MORE THAN ONE FIELD IN A MESSAGE TEXT IS TO BE 00115000
* REPLACED BY CALLER-SUPPLIED DATA SPECIFIED BY GPR0/GPR1 00116000
* AT INPUT, THE VARIOUS FIELDS MUST BE DELIMITED BY 00117000
* BINARY ZEROES; EACH INDIVIDUAL FIELD CAN THUS HAVE BLANKS 00118000
* IMBEDDED IF DESIRED; GPR0 IS THE COUNT OF THE TOTAL DATA 00119000
* SUPPLIED BY THE CALLER, AND GPR1 THE BEGINNING ADDRESS. 00120000
* 00121000
* (THIS MAKES IT POSSIBLE FOR A USER-SUPPLIED FIELD 00122000
* TO BE A DIFFERING NUMBER OF ENGLISH WORDS, FOR EXAMPLE 00123000
* 'USERID' OR 'NNN USERS' OR THE LIKE.) 00124000
* 00125000
* EXAMPLE OF A CALL 00126000
* 00127000
* LA R2,MSGNUMBER 00128000
* LA R0,DATALENGTH 00129000
* LA R1,DATADDRESS 00130000
* ICM R0,14,=C'MODULE ID' 00131000
* O R2,X'OPTIONS' 00132000
* CALL DMKERMSG 00133000
* 00134000
* EXAMPLE OF AN ERROR MESSAGE 00135000
* 00136000
* DMKXXXMMMZ ERROR MESSAGE TEXT 00137000
* 00138000
* XXX MODULE ID OF THE REQUESTING MODULE 00139000
* 00140000
* MMM ERROR MESSAGE NUMBER AND RETURN CODE 00141000
* 00142000
* Z ACTION CHARACTER 00143000
EJECT 00144000
* OPERATION - 00145000
* 00146000
* 1. PAGE IN THE APPROPRIATE ERROR MESSAGE TEXT MODULE. 00147000
* LOCATE THE REQUESTED MESSAGE TEXT AND INSERT PROGRAM ID, 00148000
* MODULE ID, MESSAGE NUMBER AND DATA IF ANY. 00149000
* 00150000
* 2. PRINT THE MESSAGE WITH THE OPTION SPECIFIED IN GPR2. 00151000
* 00152000
* 3. RETURN TO THE CALLER OR CALLER'S CALLER AS REQUESTED 00153000
* 00154000
* 4. IF NO MESSAGE TEXT IS FOUND THE PROGRAM ID , MODULE ID AND 00155000
* MESSAGE NUMBER WILL BE PRINTED, WITH ANY MESSAGE SUPPLIED 00156000
* BY THE CALLER ADDED "AS IS". 00157000
* 00158000
* 5. IF NO DATA IS PASSED BY THE CALLER FOR A MESSAGE TEXT 00159000
* WITH A $ SIGN, THE $ SIGN WILL BE CHANGED TO A 00160000
* BLANK. 00161000
* 00162000
* RESPONSES - NONE 00163000
* 00164000
* ERROR MESSAGES - ALL OF THEM 00165000
*. 00166000
SPACE 2 00167000
DMKERM START 00168000
SPACE 00169000
DC CL8'DMKERM ' MODULE NAME @VA04779 00169300
SPACE 2 00169600
EXTRN DMKSYSRM,DMKCVTBD @V2B2638 00171000
EXTRN DMKEMA00,DMKEMB00,DMKEMC00 @V5088AB 00172100
SPACE 2 00173000
USING PSA,R0 00174000
USING BUFFER,R9 00175000
USING VMBLOK,R11 00176000
USING SAVEAREA,R13 00177000
SPACE 2 00178000
DMKERMSG RELOC , EDIT, TYPE SYSTEM ERROR MSG @VA04779 00181400
SPACE 00182000
SLR R3,R3 CLEAR COUNT OF USER DATA (TENTATIVELY) 00183000
LTR R4,R1 GET DATA ADDRESS OR DATA 00184000
BZ GETMBUF IF NOTHING THERE LEAVE R3 = 0 00185000
IC R3,SAVER0+3 R1 NOT ZERO, GET CALLER'S DATA COUNT 00186000
GETMBUF EQU * 00187000
SPACE 00188000
LA R0,BUFSIZE LENGTH FOR BUFFER 00189000
CALL DMKFREE GET STORAGE FOR OUTPUT BUFFER 00190000
LR R9,R1 BASE FOR BUFFER 00191000
SPACE 00192000
MVC BUFFER+8(8),BLANKS CLEAR BUFFER TO BLANKS 00193000
MVC BUFFER+16(BUFINLTH-16),BUFFER+8 ... @V200820 00194000
MVC BUFFER(3),=C'DMK ' SET 1ST 3 CHARS TO 'DMK' @V200820 00195000
MVC BUFFER+3(3),SAVER0 NEXT 3 CHARS TO CALLER'S MODULE ID 00196000
L R1,XRIGHT16 ISOLATE THE MSG NUMBER 00197000
NR R1,R2 . . . 00198000
CALL DMKCVTBD CONVERT IT FOR PRINTING 00199000
STCM R1,B'0111',BUFFER+6 PUT IT IN THE OUTPUT LINE 00200000
MVI BUFFER+9,C'E' SET DEFAULT ACTION CHARACTER 00201000
CLI SAVER2+1,X'00' CALLER SUPPLIED ACTION CHARACTER ?? 00202000
BE INITREGS NO - USE DEFAULT 00203000
MVC BUFFER+9(1),SAVER2+1 MOVE IN CALLER'S ACTION CODE 00204000
SPACE 00205000
INITREGS EQU * BRING IN THE ERROR MESSAGE MODULE@V200820 00206000
N R2,XRIGHT16 ISOLATE THE MESSAGE NUMBER @V2B2638 00207000
L R1,=A(DMKEMA00) ADDRESS OF FIRST MSG MOD @V2B2638 00208000
C R2,=F'139' IS THE MESSAGE IN THERE ? @VA15526 00209160
BNH TRANS YES, GO TRANS IT IN. @V2B2638 00210000
L R1,=A(DMKEMB00) ADDRESS OF THE NEXT MSG MOD @V2B2638 00211000
C R2,=F'423' IS THE MESSAGE IN THERE? @V5088AB 00211100
BNH TRANS YES, GO TRANS IT IN @V5088AB 00211200
L R1,=A(DMKEMC00) ADDRESS OF NEXT MSG MODULE @V5088AB 00211300
TRANS EQU * BRING IN THE PROPER MODULE @V2B2638 00212000
TRANS 2,1,OPT=(BRING,DEFER,SYSTEM) GET IT IN CORE @V200820 00213000
LR R7,R2 START OF THE MESSAGE LIST TO GR7 @V200820 00214000
LH R2,SAVER2+2 MESSAGE NUMBER INTO GR2 @V200820 00215000
LA R8,BUFFER+11 AND R8 POINTS TO WHERE TO PUT MSG 00216000
CLI SAVER0+3,X'00' LENGTH ARGUMENT PRESENT 00217000
BE MSGLOOP NO - NO NEED TO TEST ADDRESS 00218000
L R6,=A(DMKSYSRM) ADDRESS OF WORD CONTAINING 00219000
CLC SAVER1(4),0(R6) TOP OF STORAGE ADDRESS 00220000
BNL ADDRBAD IF NO GOOD, DON'T BLOW THE SYSTEM. 00221000
SPACE 00222000
MSGLOOP SR R6,R6 00223000
IC R6,0(,R7) GET DISPLACEMENT TO NEXT MESSAGE 00224000
LTR R6,R6 IS THIS THE END OF THE MSG LIST 00225000
BZ NOTINLST IF YES, USE WHATEVER CALLER GAVE INSTEAD 00226000
LA R5,123 MAX LENGTH OF MESSAGE 00227000
SR R5,R6 SUBTRACT TEXT LENGTH 00228000
ST R5,BUFCNT STORE MAX INPUT DATA ALLOWED 00229000
AR R6,R7 ADDRESS OF THE NEXT MSG TEXT 00230000
LH R5,1(,R7) MESSAGE ID 00231000
CR R2,R5 IS THIS THE RIGHT MESSAGE 00232000
BE EQUAL YES - PROCESS 00233000
LR R7,R6 UPDATE MSG REG 00234000
B MSGLOOP 00235000
SPACE 00236000
EQUAL LA R10,3(,R7) ADDRESS OF MSG TEXT 00237000
LR R15,R10 LOAD WORK REGISTER 00238000
SR R14,R14 ZERO COUNT WORK REGISTER 00239000
LA R0,1 R0 = 1 (FOR GENERAL USE) 00240000
SPACE 00241000
LOOP$ CLI 0(R15),C'$' IS THIS A $ SIGN ?? 00242000
BE FOUND$ YES - 00243000
AR R14,R0 UPDATE COUNT 00244000
AR R15,R0 UPDATE SCAN ADDRESS 00245000
LOOPCHEK CR R15,R6 END OF THIS MSG TEXT ?? 00246000
BL LOOP$ NO - KEEP LOOKING 00247000
* 00248000
LTR R14,R14 MOVE COUNT ZERO ?? 00249000
BZ LAST$ YES - $ MUST BE LAST CHARACTER 00250000
BCTR R14,0 -1 FOR MOVE 00251000
EX R14,MVCDATA MOVE TEXT UP TO $ TO OUTPUT 00252000
AR R14,R0 CORRECT COUNT 00253000
LAST$ AR R0,R14 COUNT PLUS ONE 00254000
AR R0,R8 POINT TO END OF MESSAGE PLUS ONE 00255000
SR R0,R9 GET LENGTH OF MESSAGE 00256000
B MSGFIN GO PRINT MSG 00257000
SPACE 00258000
FOUND$ LTR R14,R14 COUNT ZERO ?? 00259000
BZ ZERO YES - 00260000
BCTR R14,0 -1 FOR MOVE 00261000
EX R14,MVCDATA MOVE TEXT UP TO $ TO OUTPUT 00262000
A R14,F2 CORRECT COUNT 00263000
ZERO AR R15,R0 UPDATE SEARCH ADDRESS 00264000
LR R10,R15 UPDATE MOVE ADDRESS 00265000
AR R8,R14 UPDATE OUTPUT ADDRESS TO ONE BLANK 00266000
* PAST THE LAST OUTPUT DATA 00267000
SR R14,R14 R14=0 FOR RESUMING SCAN OF TEXT 00268000
LTR R3,R3 INPUT COUNT ZERO ?? 00269000
BNP NOCNT YES - DATA IN REGISTER 4 00270000
C R3,BUFCNT COUNT LARGER THAN ALLOWED ?? 00271000
BNH *+8 NO -- VALID COUNT 00272000
L R3,BUFCNT COUNT TOO HIGH USE MAX 00273000
* SCAN FOR FIRST NON-BINARY-ZERO CHARACTER: 00274000
SCNZER1 CLI 0(R4),X'00' BINARY ZERO THERE ? 00275000
BNE SCNZER2 NOPE - WE'RE ALL SET. 00276000
ALR R4,R0 ADVANCE TO NEXT BYTE OF USER DATA 00277000
BCT R3,SCNZER1 KEEP CHECKING FOR NON-BINARY-ZERO CHAR. 00278000
AR R8,R0 IF R3=0, UPDATE OUTPUT ADDRESS BY ONE 00279000
B SCNZER5 GO CLEAR R4 AND FINISH UP. 00280000
* 00281000
* NON-BINARY-ZERO CHARACTER FOUND - SCAN TO END OF NON-ZERO-STRING: 00282000
SCNZER2 LR R1,R4 R1 = ADDRESS OF BEGINNING OF STRING 00283000
LR R2,R3 R2 = TOTAL REMAINING BYTE COUNT 00284000
SCNZER3 CLI 0(R1),X'00' BINARY ZERO THERE ? 00285000
BE SCNZER4 YES - WE'VE FOUND END OF STRING 00286000
ALR R1,R0 BUMP TO NEXT ADDRESS 00287000
BCT R2,SCNZER3 AND KEEP CHECKING 00288000
* 00289000
SCNZER4 SR R1,R4 COMPUTE NUMBER OF BYTES IN THE FIELD 00290000
BCTR R1,0 LESS 1 FOR EX-MVC 00291000
EX R1,MVCARG MOVE USER DATA TO OUTPUT AREA 00292000
AR R1,R0 RESTORE R1 AGAIN 00293000
LA R8,1(R8,R1) UPDATE OUTPUT ADDRESS 00294000
AR R4,R1 NEW R4 FOR NEXT TIME 00295000
SR R3,R1 AND NEW R3 FOR NEXT TIME 00296000
BP LOOPCHEK IF R3 > 0, GO CHECK FOR COMPLETION. 00297000
SCNZER5 SLR R4,R4 R4 & R3 = 0 MEANS NO USER DATA LEFT 00298000
B LOOPCHEK GO CHECK FOR COMPLETION. 00299000
SPACE 00300000
NOCNT LR R3,R0 R3=1 TO UPDATE COUNT 00301000
LTR R5,R4 ANY INPUT DATA ?? 00302000
BZ COUNT NO - BLANK $ AND KEEP GOING 00303000
SLR R4,R4 SIGNAL OUTPUT DATA USED UP FOR NEXT TIME 00304000
LA R3,4 UPDATE COUNT 00305000
STCM R5,7,0(R8) STORE R1 DATA IN OUTPUT AREA 00306000
CLI SAVER1,C' ' HIGH ORDER BLANK ?? 00307000
BE COUNT YES - THE 3 LOW-ORDER BYTES ARE ENUF 00308000
ST R5,0(,R8) STORE FULL WORD INTO OUTPUT 00309000
LA R3,5 DATA COUNT PLUS 1 BLANK 00310000
COUNT AR R8,R3 UPDATE OUTPUT ADDRESS 00311000
SLR R3,R3 SIGNAL NO DATA LEFT 00312000
B LOOPCHEK AND GO CHECK FOR COMPLETION. 00313000
SPACE 00314000
ADDRBAD LA R0,12 BAD ADDRESS FROM CALLER, JUST SHOW MSG ID 00315000
B MSGFIN2 ... 00316000
* 00317000
HLOWRLIM EQU ADDRBAD+2 LOWER LIMIT FOR BYTE COUNT FOR DMKQCNWT 00318000
SPACE 00319000
NOTINLST DS 0H MESSAGE NUMBER NOT FOUND IN THE LIST 00320000
LA R2,255 00321000
LM R0,R1,SAVER0 RESTORE CALLER'S R0-R1 00322000
NR R2,R0 DID CALLER GIVE US A COUNT ? 00323000
BNZ MVCALDAT IF YES - MOVE IN WHATEVER DATA HE GAVE US 00324000
LA R0,15 NO - MAKE THE COUNT 15, 00325000
MVC BUFFER+11(4),SAVER1 AND PUT IN THE CALLER'S R1 00326000
B MSGFIN AND JUST USE THAT. 00327000
* 00328000
MVCALDAT BCTR R2,0 COUNT OF CALLER'S MESSAGE 00329000
LA R10,0(,R1) AND THE ADDRESS 00330000
LA R0,BUFINLTH-12 DON'T OVERFLOW OUR STORAGE 00331000
CLR R2,R0 ... 00332000
BNH *+6 WE'RE OK 00333000
LR R2,R0 LIMIT MESSAGE IF CALLER GAVE HUGE NUMBER 00334000
EX R2,MVCDATA MOVE CALLER'S MESSAGE 00335000
LA R0,12(,R2) AND SET THE BYTE-COUNT 00336000
* 00337000
MSGFIN DS 0H CONSTRUCTION OF MESSAGE IS FINISHED: 00338000
LR R15,R0 COMPUTE ADDRESS OF LAST BYTE OF MESSAGE 00339000
AR R15,R9 ... 00340000
MSGFIN1 BCTR R15,0 ... 00341000
CLI 0(R15),C' ' TRAILING BLANK ? 00342000
BNE MSGFIN2 NOPE - WE'RE ALL SET. 00343000
BCTR R0,0 DELETE ONE FROM BYTE COUNT 00344000
CH R0,HLOWRLIM IS BYTE-COUNT > LOWER LIMIT FOR DMKQCNWT? 00345000
BH MSGFIN1 IF YES, CHECK FOR MORE TRAILING BLANKS 00346000
MSGFIN2 TM SAVER2,X'40' DOES CALLER HAVE AN AREA TO BE FRET'D ? 00347000
BZ PRTMSG NOPE - GO PRINT THE MESSAGE NOW. 00348000
LR R3,R0 REMEMBER THE BYTE-COUNT, 00349000
SLR R0,R0 00350000
IC R0,SAVER3 NO. DOUBLE WORDS INTO R0, 00351000
L R1,SAVER3 ADDRESS INTO R1 (HIGH-ORDER BYTE IS OK) 00352000
CALL DMKFRET FRET WHATEVER THE CALLER WANTED US TO 00353000
LR R0,R3 AND RESTORE R0 TO THE BYTE-COUNT 00354000
PRTMSG LR R1,R9 MSG ADDRESS 00355000
LA R3,BUFSIZE SIZE OF BUFFER 00356000
LA R2,(NORET+DFRET) WE USE THESE PARAMETERS 00357000
TM SAVER2,X'08' DELETE ERRMSG PARM FIELD ?? 00358000
BO *+8 YES -- 00359000
LA R2,ERRMSG(,R2) ADD - ERRMSG TO PARM FIELD 00360000
TM SAVER2,X'20' OPERATOR FOR PARM FIELD ?? 00361000
BZ *+8 NO - 00362000
LA R2,OPERATOR(,R2) YES - ADD TO PARM FIELD 00363000
TM SAVER2,X'10' ALARM FOR PARM FIELD ?? 00364000
BZ *+8 NO - 00365000
LA R2,ALARM(,R2) YES - ADD TO PARM FIELD 00366000
SLR R4,R4 CLEAR FOR RETURN CODE @VM03144 00367000
ICM R4,B'0011',SAVER2+2 PICK UP RETURN CODE @VM03144 00368000
TM SAVER2,X'80' DOES CALLER WANT CONTROL BACK? @VM03144 00369000
BO *+6 YES, SKIP 'SAVE AREA RELEASE' @VM03144 00370000
SVC 16 DONE WITH THAT SAVE AREA @VM03144 00371000
ST R4,SAVER2 SET RET CODE IN CALLERS R2 @VM03144 00372000
CALL DMKQCNWT NOW SEND THE MSG ON ITS WAY @VM03144 00373000
EXIT 00374000
EJECT 00375000
MVCDATA MVC 0(*-*,R8),0(R10) TO MOVE MESSAGE TEXT TO MESSAGE BUFFER 00376000
MVCARG MVC 0(*-*,R8),0(R4) TO MOVE CALLER DATA TO MESSAGE BUFFER 00377000
SPACE 2 00378000
LTORG 00379000
EJECT 00380000
PSA 00381000
COPY VMBLOK 00382000
COPY SAVE 00383000
COPY EQU 00384000
COPY CONBUF 00385000
END DMKERM 00386000