CPF TITLE 'DMSCPF (CMS) VM/370 - RELEASE 6' 00001000
SPACE 2 00002000
* MODULE NAME - 00003000
* 00004000
* DMSCPF (CP) 00005000
* 00006000
* FUNCTION - 00007000
* 00008000
*| TO PASS A VIRTUAL CONSOLE FUNCTION TO CP370 FOR EXECUTION 00009000
* 00010000
* ATTRIBUTES - 00011000
* 00012000
*| NUCLEUS RESIDENT, SERIALLY REUSABLE, CALLED BY BALR OR SVC 00013000
* 00014000
* ENTRY POINTS - 00015000
* 00016000
*| DMSCPF - PASS A VIRTUAL CONSOLE FUNCTION TO CP370 00017000
* 00018000
* ENTRY CONDITIONS - 00019000
* 00020000
*| GPR 0 = LENGTH OF COMMAND LINE (IF IT IS AT CMNDLINE) 00021000
*| GPR 1 = ADDRESS OF COMMAND LINE 00022000
*| GPR 14 = RETURN ADDRESS 00023000
*| GPR 15 = ADDRESS OF DMSCPF 00024000
* 00025000
* EXIT CONDITIONS - 00026000
* 00027000
*| NORMAL - CONDITION CODE = 0 00028000
*| GPR 15 = 0 00029000
* 00030000
*| ERROR - CONDITION CODE = 2 00031000
*| GPR 15 = ERROR CODE RETURNED FROM CONSOLE FUNCTION 00032000
* 00033000
* CALLS TO OTHER ROUTINES - 00034000
* 00035000
*| DMSCWT - TO WAIT FOR ALL CONSOLE I/O TO COMPLETE 00036000
*| DMSBTP - TO CHECK FOR VALID CP COMMAND AND TO NOTIFY @VA12652 00036200
*| BATCH OF LINK COMMAND FAILURE. @VA12652 00036400
*| DMSINA - TO CHECK FOR SYNONYM OF CP COMMANDS. @VA12652 00036600
* 00037000
* EXTERNAL REFERENCES - 00038000
* 00039000
* NONE 00040000
* 00041000
* TABLES / WORKAREAS - 00042000
* 00043000
*| BALRSAVE - SAVE AREA FOR CALLER'S REGISTERS 0 - 15 00044000
*| CMNDLINE - COMMAND LINE MOVED HERE BEFORE CALLING CP 00045000
*| BATFLAGS - NOTIFY BATCH DMSCPF IS CALLING @VA12652 00045300
*| BATFLAG3 - NOTIFY BATCH OF FAILED LINK COMMAND @VA12652 00045600
* 00046000
* REGISTER USAGE - 00047000
* 00048000
*| GPR 0 = WORK REGISTER 00049000
*| GPR 1 = WORK REGISTER 00050000
*| GPR 2 = ADDRESS OF COMMAND LINE 00051000
*| GPR 3 = LENGTH OF COMMAND LINE 00052000
*| GPR 4 = CONSTANT 1 00053000
*| GPR 5 = END OF COMMAND LINE 00054000
*| GPR 6 = SCRATCH 00055000
*| GPR 7 = CURRENT ARGUMENT SIZE 00056000
*| GPR 8 = CONSTANT 8 00057000
*| GPR 9 = ADDR OF COMMAND LIST 00058000
*| GPR 10 = INDICATES ORIGIN OF COMMAND 00059000
*| GPR 11 = TEMP STORAGE FOR BALRSAVE REGS @VA12652 00060000
*| GPR 12 = BASE REGISTER 00061000
*| GPR 13 = NOT USED 00062000
*| GPR 14 = RETURN ADDRESS 00063000
*| GPR 15 = RETURN CODE 00064000
* 00065000
* NOTES - 00066000
* 00067000
* NONE 00068000
* 00069000
* OPERATION - 00070000
* 00071000
*| IF IT IS NOT ALREADY THERE, DMSCPF MOVES THE COMMAND LINE TO 00072000
*| 'CMNDLINE' COMPRESSING OUT ANY EXCESS BLANKS. IT THEN CALLS 00073000
*| DMSCWT TO WAIT FOR ALL CONSOLE I/O TO COMPLETE SO THAT ANY 00074000
*| OUTPUT FROM THE CP FUNCTION WILL BE SYNCHRONIZED WITH ANY 00075000
*| PREVIOUS OUTPUT LINES FROM CMS. IT THEN ISSUES A DIAGNOSE 00076000
*| INSTRUCTION WITH A CODE OF 8 TO PASS THE CONSOLE FUNCTION TO 00077000
*| CP TO EXECUTE. UPON RETURN FROM CP, DMSCPF EXITS WITH THE 00078000
*| RETURN CODE IN REGISTER 15. 00079000
* HRC350DS 00079020
*| If the first argument is FIFO or LIFO, the output HRC350DS 00079040
*| from the CP command is placed in the console stack. HRC350DS 00079060
*| If the first argument is DISCARD, the output from the HRC350DS 00079080
*| CP command is discarded. In either of these cases if HRC350DS 00079100
*| the CP command issues a prompt (for a password), that HRC350DS 00079120
*| prompt is not stacked or discarded. HRC350DS 00079140
* 00080000
*. 00081000
EJECT 00082000
DMSCPF START 0 EXECUTE A CP CONSOLE FUNCTION 00083000
USING NUCON,R0 00084000
STM R0,R15,BALRSAVE SAVE THE CALLER'S REGISTERS 00085000
LR R12,R15 LOAD THE PROGRAM BASE REGISTER 00086000
USING DMSCPF,R12 00087000
LR R10,R12 INITIALIZE R10 NON-ZERO @V60BBBB 00087100
SR R11,R11 INITIALIZE R11 @VA12652 00087150
TM BATFLAGS,BATRUN IS THIS COMMAND FROM BATCH? @V60BBBB 00087200
BZ NOTBATA BR IF NOT @V60BBBB 00087300
SLR R10,R10 SET FOR NO PASSWORD-SUPPRESSION @V60BBBB 00087400
NOTBATA DS 0H @V60BBBB 00087500
LA R1,0(,R1) MAKE SURE THE HIGH ORDER BYTE IS ZERO 00088000
LA R2,CMNDLINE POINT TO THE COMMAND INPUT LINE 00089000
CLR R1,R2 IS THE LINE ALREADY AT 'CMNDLINE' ? 00090000
BE CHECKLEN YES, PASS IT TO CP WITHOUT EDITING 00091000
SLR R10,R10 INDICATE FROM EXEC OR MODULE @V60BBBB 00091050
TM BATFLAGS,BATRUN+BATLOAD V0742 00091100
BC 11,NOTBAT DROP IF BATCH NOT RUNNING V0742 00091150
TM BATFLAGS,BATUSEX V0742 00091200
BZ NOTBAT DROP IF NOT BATCH USER JOB V0742 00091250
OI BATFLAGS,BATCPEX SIGNAL FOR BATCH ENTRY V0742 00091300
LR R3,R10 SAVE R10 ACROSS BATCH CALL @V60BBBB 00091320
L R15,ABATPROC V0742 00091350
BALR R14,R15 GO TO BATCH... V0742 00091400
LR R10,R3 RESTORE R10 @V60BBBB 00091420
LTR R3,R15 TEST BATCH RET CODE V0742 00091450
BNZ CPRETURN NOT ALLOWED BY BATCH V0742 00091500
SPACE 00091550
NOTBAT EQU * PROCESS THE CP COMMAND V0742 00091600
LA R3,CMNDLINE POINT TO THE COMMAND LINE BUFFER 00092000
LA R4,1 LOAD THE POINTER INCREMENT 00093000
LA R5,131(,R3) LOAD MAXIMUM BUFFER ENDING ADDRESS 00094000
SR R6,R6 CLEAR THE WORK REGISTER 00095000
SR R7,R7 SET ARGUMENT SIZE TO ZERO 00096000
LA R8,8 LOAD THE MAXIMUM ARGUMENT SIZE 00097000
B CHECKXFF MOVE THE COMMAND LINE TO 'CMNDLINE' 00098000
SPACE 00099000
FINDARGS AR R1,R4 POINT TO NEXT CHARACTER IN INPUT LINE 00100000
CLC 0(4,R1),=X'FFFFFFFF' IS IT THE INPUT LINE END? @VA09492 00101000
BE COMPTLEN YES, COMPUTE LINE LENGTH AND CONTINUE 00102000
CLI 0(R1),C' ' IS THIS THE START OF AN ARGUMENT ? 00103000
BE FINDARGS NO, LOOK AT THE NEXT CHARACTER 00104000
B MOVEBLNK YES, MOVE A BLANK TO THE COMMAND BUFFER 00105000
SPACE 00106000
CHECKBSC CLI 0(R1),BS IS THIS CHARACTER A BACKSPACE ? 00107000
BNE MOVEBLNK NO, CONTINUE NORMALLY 00108000
AR R1,R4 POINT TO NEXT CHARACTER IN INPUT LINE 00109000
LA R7,1 SET ARGUMENT LENGTH TO 1 00110000
B FINDARGE CONTINUE WITHOUT INSERTING A DELIMITER 00111000
SPACE 00112000
MOVEBLNK MVI 0(R3),C' ' MOVE IN A BLANK DELIMITER 00113000
BXH R3,R4,COMPTLEN POINT TO NEXT CHARACTER IN THE BUFFER 00114000
SR R7,R7 RESET ARGUMENT LENGTH TO ZERO 00115000
FINDARGE CLI 0(R1),C' ' IS THIS THE END OF THE ARGUMENT ? 00116000
BE FINDARGS YES, FIND THE START OF THE NEXT ONE 00117000
CR R7,R8 IS THIS ARGUMENT THE MAXIMUM LENGTH ? 00118000
BE CHECKBSC YES, ADD A DELIMITER TO THE BUFFER 00119000
AR R7,R4 ADD ONE TO THE ARGUMENT LENGTH 00120000
IC R6,0(,R1) MOVE THE CHARACTER TO COMMAND BUFFER 00121000
STC R6,0(,R3) ... 00122000
BXH R3,R4,COMPTLEN POINT TO NEXT CHARACTER IN THE BUFFER 00123000
AR R1,R4 POINT TO NEXT CHARACTER IN INPUT LINE 00124000
CHECKXFF CLC 0(4,R1),=X'FFFFFFFF' END OF INPUT LINE? @VA09492 00125000
BNE FINDARGE NO, CONTINUE SCANNING THE LINE 00126000
COMPTLEN LR R0,R3 SAVE POINTER TO LAST CHARACTER 00127000
SR R0,R2 COMPUTE THE LENGTH OF THE CP COMMAND 00128000
CHECKLEN LTR R3,R0 CHECK FOR A VALID LENGTH 00129000
BNP CPRETURN RETURN IF LENGTH IS INVALID 00130000
FINDCHAR CLI 0(R2),C' ' IS THIS CHARACTER A BLANK ? 00131000
BNE CHKIMPCP NO, CHECK FOR IMPLIED CP FUNCTION 00132000
LA R2,1(,R2) POINT TO THE NEXT CHARACTER 00133000
BCT R3,FINDCHAR DECREMENT LENGTH AND CONTINUE 00134000
B CPRETURN RETURN IF NO FUNCTION SPECIFIED 00135000
SPACE 00136000
CHKIMPCP IC R6,=C' ' MOVE A BLANK TO END OF COMMAND LINE 00137000
STC R6,0(R2,R3) ... 00138000
CLC 0(3,R2),=C'CP ' IS 'CP' THE FIRST ARGUMENT ? 00139000
BE FOUNDCP YES,GO TO IT @VA06272 00140050
LA R0,72 GET STORAGE TO PROTECT USER'S REGS @VA12652 00140057
SRL R0,3 CHANGE TO DOUBLE WORDS @VA12652 00140064
DMSFREE DWORDS=(0),TYPCALL=BALR @VA12652 00140071
LR R11,R1 SAVE GOTTEN AREA ADDRESS @VA12652 00140078
ST R0,0(,R11) SAVE DOUBLE WORD SIZE @VA12652 00140085
MVC 4(64,R11),BALRSAVE PROTECT CALLER'S REGS @VA12652 00140092
LA R9,CMNDLIST POINT TO COMMAND LIST @VA06272 00140100
LM R0,R1,0(R9) GET THE NAME... @VA06272 00140150
L R15,=V(ABBREV) TO CHECK FOR SYNONYM... @VA06272 00140200
BALR R14,R15 FOR 'CP' @VA06272 00140250
LTR R15,R15 SYNONYM FOUND? @VA06272 00140300
BNZ PASSTOCP NO @VA06272 00140350
ICM R1,B'1110',=C'CP ' SHOULD BE 'CP' @VA06272 00140400
CLR R0,R1 IF NOT.... @VA06272 00140450
BNE PASSTOCP PASS TO CP ANYWAY @VA06272 00140500
LR R1,R2 POINT TO COMMAND LINE @VA06272 00140550
CKFORBLK EQU * @VA06272 00140600
MVI 0(R1),C' ' BLANK OUT SYNONYM.... @VA06272 00140650
LA R1,1(,R1) SO THAT.... @VA06272 00140700
CLI 0(R1),C' ' DIAGNOSE IS OK @VA06272 00140750
BE FINDFUNC GO TO ISSUE DIAGNOSE @VA06272 00140800
B CKFORBLK LOOK FOR BLANKS @VA06272 00140850
FOUNDCP EQU * @VA06272 00140900
LA R2,2(,R2) POINT BEYOND THE 'CP' 00141000
S R3,=F'2' AND SUBTRACT 2 FROM THE LENGTH 00142000
BNP PASSTOCP BRANCH IF NO FUNCTION SPECIFIED 00143000
FINDFUNC CLI 0(R2),C' ' IS THIS THE START OF THE NEXT ARGUMENT ? 00144000
BNE PASSTOCP YES, PASS THE COMMAND TO CP 00145000
LA R2,1(,R2) POINT TO THE NEXT CHARACTER 00146000
BCT R3,FINDFUNC SUBTRACT 1 FROM THE LENGTH AND CONTINUE 00147000
PASSTOCP LA R1,=CL8'CONWAIT' POINT TO DMSCWT PLIST 00148000
SVC 202 WAIT FOR ALL CONSOLE I/O TO COMPLETE 00149000
LTR R10,R10 COMMAND FROM MODULE/EXEC? @V60BBBB 00149200
BZ MODOREX BR IF YES @V60BBBB 00149400
O R3,=X'80000000' REQUEST PASSWORD SUPPRESSION @V60BBBB 00149600
MODOREX DS 0H @V60BBBB 00149800
* Now check the first word of the command line. Is it FIFO, HRC350DS 00149802
* LIFO, or DISCARD? HRC350DS 00149804
CLC 0(5,R2),FIFO is it 'FIFO' HRC350DS 00149806
BNE CKLIFO nope HRC350DS 00149808
LA R6,1 remember FIFO HRC350DS 00149810
LA R2,5(R2) skip past 'FIFO ' HRC350DS 00149812
S R3,FIVE decrement CP command length HRC350DS 00149814
B SPECIAL HRC350DS 00149816
CKLIFO DS 0H HRC350DS 00149818
CLC 0(5,R2),LIFO is it 'LIFO' HRC350DS 00149820
BNE CKDISC nope HRC350DS 00149822
LA R6,2 remember LIFO HRC350DS 00149824
LA R2,5(R2) skip past 'LIFO ' HRC350DS 00149826
S R3,FIVE decrement CP command length HRC350DS 00149828
B SPECIAL HRC350DS 00149830
CKDISC DS 0H HRC350DS 00149832
CLC 0(8,R2),DISCARD is it 'DISCARD' HRC350DS 00149834
BNE NORMAL nope HRC350DS 00149836
SR R6,R6 remember DISCARD HRC350DS 00149838
LA R2,8(R2) skip past 'DISCARD ' HRC350DS 00149840
S R3,EIGHT decrement CP command length HRC350DS 00149842
* We will issue the DIAGNOSE instruction with output directed HRC350DS 00149844
* to a buffer so we can stack it or discard it. HRC350DS 00149846
SPECIAL DS 0H HRC350DS 00149848
LTR R3,R3 anything left in the buffer? HRC350DS 00149850
BZ WRAPUP HRC350DS 00149852
L R0,BUFSIZE buffer for CP output (in DWORDs) HRC350DS 00149854
DMSFREE DWORDS=(0),TYPCALL=BALR HRC350DS 00149856
LR R4,R3 move CP command length to R4 HRC350DS 00149858
LR R3,R1 address of buffer for CP output HRC350DS 00149860
LR R9,R1 and save it HRC350DS 00149862
LR R7,R1 and again HRC350DS 00149864
L R5,EIGHTK length of output buffer HRC350DS 00149866
* At last we issue the CP command. HRC350DS 00149868
* R2 = command, R3 = buffer, R4 = command len, R5 = buffer len HRC350DS 00149870
ICM R4,8,=X'40' request CP output to our buffer HRC350DS 00149872
DIAG R2,R4,8 issue the CP command HRC350DS 00149874
LTR R8,R4 save return code from CP command HRC350DS 00149876
BNZ THATSALL if error, don't stack result HRC350DS 00149878
LTR R6,R6 are we stacking the result? HRC350DS 00149880
BZ THATSALL no, so we are done HRC350DS 00149882
* Prepare the ATTN plist that will stack the CP command output HRC350DS 00149884
A R9,EIGHTK R9 = space for ATTN plist HRC350DS 00149886
USING ATTNPL,R9 HRC350DS 00149888
MVC ATTNPL(8),ATTN move in 'ATTN ' HRC350DS 00149890
BCT R6,SPECIAL1 HRC350DS 00149892
MVC ATTNHOW(4),FIFO stacking FIFO HRC350DS 00149894
B SPECIAL2 HRC350DS 00149896
SPECIAL1 DS 0H HRC350DS 00149898
MVC ATTNHOW(4),LIFO stacking LIFO HRC350DS 00149900
SPECIAL2 DS 0H HRC350DS 00149902
BCTR R3,0 prime the pump HRC350DS 00149904
* Loop to place each output line from CP on the stack. HRC350DS 00149906
CPNXTLIN DS 0H HRC350DS 00149908
LA R3,1(R3) skip previous linend character HRC350DS 00149910
LR R2,R3 start of this line HRC350DS 00149912
* Loop to find the end of this line. HRC350DS 00149914
CPNXTCHR DS 0H HRC350DS 00149916
CLI 0(R3),X'15' are we at the end of this line? HRC350DS 00149918
BE CPSTACK1 yes, go stack it HRC350DS 00149920
LA R3,1(R3) no, on to next character HRC350DS 00149922
BCT R5,CPNXTCHR continue loop until buffer end HRC350DS 00149924
* We have a line, now stack it. HRC350DS 00149926
CPSTACK1 DS 0H HRC350DS 00149928
LR R10,R3 save scan pointer HRC350DS 00149930
SR R3,R2 length of this line of output HRC350DS 00149932
BCTR R5,0 account for linend character HRC350DS 00149934
ST R2,ATTNLEN address of line to stack HRC350DS 00149936
STC R3,ATTNLEN put line length in ATTN plist HRC350DS 00149938
LR R1,R9 HRC350DS 00149940
SVC 202 stack the line HRC350DS 00149942
DC AL4(THATSALL) go here if an error HRC350DS 00149944
LR R3,R10 restore scan pointer HRC350DS 00149946
LTR R5,R5 more lines to process? HRC350DS 00149948
BP CPNXTLIN yes, go scan and stack them HRC350DS 00149950
DROP R9 HRC350DS 00149952
* Our work here is done. HRC350DS 00149954
THATSALL DS 0H HRC350DS 00149956
L R0,BUFSIZE buffer size HRC350DS 00149958
LR R1,R7 get address of buffer to free HRC350DS 00149960
DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR HRC350DS 00149962
LR R3,R8 CP return code into R3 HRC350DS 00149964
B WRAPUP HRC350DS 00149966
NORMAL DS 0H HRC350DS 00149968
DC X'83230008' PASS COMMAND LINE TO CP TO EXECUTE 00150000
WRAPUP DS 0H HRC350DS 00150020
LA R3,0(R3) CLEAR HIGH ORDER BYTE @VA10582 00150100
TM BATFLAGS,BATRUN IS BATCH ACTIVE? @VA12384 00150180
BNO CPRETURN NO - OK PLAIN RETURN @VA12384 00150260
LTR R15,R3 GOOD RETURN FROM CP? @VA12384 00150340
BZ CPRETURN OK - DON'T BOTHER BATCH. @VA12384 00150420
CLC 0(4,R2),=CL4'LINK' WAS IT LINK CMD? @VA12384 00150500
BNE CPRETURN NOT CP CMD BATCH INTERESTED IN. @VA12384 00150580
LA R9,101 SET LOWER LIMIT TEST @VA14158 00150588
CR R3,R9 IS THE RET CODE 101 -103? @VA14158 00150596
BL MODOR1 NO - VALID ERROR @VA14158 00150604
LA R9,103 SET UPPER LIMIT @VA14158 00150612
CR R3,R9 IS THE RET CODE 101 -103? @VA14158 00150620
BH MODOR1 NO - VALID ERROR @VA14158 00150628
B CPRETURN OK - DO NOT NOTIFY BATCH @VA14158 00150636
MODOR1 EQU * @VA14158 00150644
OI BATFLAG3,BATCPFNG TELL BATCH OF LINK ERROR @VA12384 00150660
OI BATFLAGS,BATCPEX TELL BATCH CPF CALLING @VA12384 00150740
L R15,ABATPROC GET BATCH ADDRESS @VA12384 00150820
BALR R14,R15 GO TO BATCH. @VA12384 00150900
CPRETURN EQU * @VA12652 00151000
LTR R1,R11 TEST AND SET GOTTEN AREA @VA12652 00151100
BZ CPRET2 NO AREA GOTTEN - DON'T FREE @VA12652 00151200
L R0,0(,R1) GET DWORD SIZE @VA12652 00151300
MVC BALRSAVE(64),4(R1) RESTORE CALLERS REGS @VA12652 00151400
DMSFRET DWORDS=(0),LOC=(1),TYPCALL=BALR @VA12652 00151500
CPRET2 EQU * @VA12652 00151600
LTR R15,R3 LOAD RETURN CODE AND SET CONDITIO@VA12652 00151700
LM R0,R14,BALRSAVE RESTORE THE CALLER'S REGISTERS 00152000
BR R14 RETURN TO THE CALLER 00153000
SPACE 3 00154000
BS EQU X'16' 00155000
EIGHTK DC A(8192) size of buffer for CP output HRC350DS 00155020
BUFSIZE DC A(1026) size of buffer in doublewords HRC350DS 00155040
FIVE DC A(5) HRC350DS 00155060
EIGHT DC A(8) HRC350DS 00155080
FIFO DC C'FIFO ' HRC350DS 00155100
LIFO DC C'LIFO ' HRC350DS 00155120
DISCARD DC C'DISCARD ' HRC350DS 00155140
ATTN DC C'ATTN ' HRC350DS 00155160
SPACE 00156000
LTORG 00157000
EJECT 00158000
NUCON 00159000
REGEQU 00160000
SPACE 1 HRC350DS 00160020
ATTNPL DSECT ATTN parameter list HRC350DS 00160040
DS CL8 'ATTN' HRC350DS 00160060
ATTNHOW DS CL4 'FIFO' or 'LIFO' HRC350DS 00160080
ATTNLEN DS AL1 length of line to be stacked HRC350DS 00160100
ATTNADD DS AL3 address of line to be stacked HRC350DS 00160120
END 00161000