VENPCCP1 ; IHS/OIT/GIS - FACILITY PRINT DEAMON ;
;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
;
; NEW PRINT DEAMON ; ERROR TRAPPING
; WORKS WITH NEW PRINT SERVICE
;
NEW N FILE,PATH,POP,REC,A,B,DFN,IP,IPA,SOCKET,%,CNT,RESULT,VISIT,SWAP,DUZ,VER25,LASTFILE
N VENIO,X,Y,Z,I,FIRST,NEXT,DEL,TOT,TMP,MSG,WAIT,CFIGIEN,TYPE,PGIEN,MRPFLAG,DEFEF,VENDEV
S X="TRAP^VENPCCP1",@^%ZOSF("TRAP") K ERRSTOP ; SET ERROR TRAP
S Y=0
I '$$INIT S %=$$STOP Q ; INITIALIZE LOCAL VARIABLES FROM CONFIG FILE ENTRIES
CYCLE I $$STOP Q ; EXTRNAL HALT
I $D(^TMP("VEN SYNC")) D SYNC^VENPCCM1 K ^TMP("VEN SYNC") G CYCLE ; PRINT DEAMON SYNC FUNCTIONS
INC S CNT=CNT+1
S @TMP=("Wait cycle #"_CNT)
I $P($G(^VEN(7.5,CFIGIEN,0)),U,21),$P($G(^VEN(7.5,CFIGIEN,0)),U,22)'=DT D CLEAN^VENPCCP3
H 5 ; CHECK EMPTY DIRECTORY EVERY 5 SECONDS
FILE I $$STOP Q
S FILE=$$NEXT(PATH,"A.txt") I FILE="" G CYCLE ; KEEP CYCLING IF DIRECTORY EMPTY
OPEN I $$STOP Q ; GET THE RECORD FROM THE DATA FILE
REC I $G(VER25) S POP=$$OPN^VENPCCP(PATH,FILE,"R","D CHUNK^VENPCCP1") I 1 ; IN 2.5, BUILD REC ARRAY IMMEDIATLY
E S POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC") ; FOR BKWD COMPATIBILITY: RETURN DATA IN THE REC STRING
I POP D DEL^VENPCCP1(PATH,FILE) G INC ; CAN'T OPEN DATA FILE. UNIX PERMISSIONS PROBLEM!!!
I '$L($G(REC)),'$L($G(REC(1))) G DFILE ; DELETE A NULL RECORD AND START OVER
BAL I $L(FILE)>5 D ; LOAD BALANCING
. F I=($L(FILE)-4):-1:1 S %=$E(FILE,I) I %=+% Q ; GET LOAD BALANCING NUMBER
. I (+%)#2 S %=IP,IP=IPA,IPA=% ; BALANCE THE LOAD
. Q
MSG S TOT=$$COUNT(PATH) ; MONITOR MSG
S MSG=TOT_" file"_$S(TOT>1:"s",1:"")_" in queue. Processing "_FILE S @TMP=MSG
TRANSMIT S RESULT=$$SEND^VENPCCP(SOCKET,IP,IPA) K REC ; TRANSMIT THE FILE TO THE PRINT SERVER!
I $$STOP Q ; EXTERNAL HALT
BAD I 'RESULT S FILE=$$NEXT(PATH,FILE) G:FILE'="" OPEN G INC ; GET NEXT Z FILE
GOOD ; !!!SUCCESS!!!
D CLEAN(PGIEN) ; CLEAN UP ANY EXISTING ERROR FLAGS
DFILE D DEL(PATH,FILE) ; DELETE DATA FILE FROM PRINT DIRECTORY
RECYCLE I $E(FILE)="Z"!($E(FILE)="z") G FILE ; GET NEXT FILE
S %=$E(FILE) S TYPE=$S(%="E":"H",%="H":"G",%="e":"h",%="h":"g",%="G":"H",%="g":"h",1:"")
I $L(TYPE) S FILE=TYPE_$E(FILE,2,99) I $$FIND^VENPCCP(PATH,FILE) G OPEN ; PRINT DOCUMENTS AS A GROUP IF POSSIBLE
G FILE
;
CHUNK ; EP - REBUILD THE RECORD IN SMALL CHUNKS THAT WILL FIT THRU THE "OPEN" WINDOW.
; THIS CODE ADDED TO AVOID THE MAXSTG AND STKOVR ERRORS EXPERIENCED UNDER VER 2.2
N I,%,X
F I=1:1 R %:10 Q:'$L(%) D
. F X=10,13 S %=$TR(%,$C(X),"") ; STRIP OFF <RETURN> FROM END OF THE RECORD
. S REC(I)=%
. Q
Q
;
; -----------------------------------------------
;
; NEW GENERIC FUNCTIONS FOR PRINT DEAMON
;
INIT() ; EP-INITIALIZE VARIABLES AND RETURN '1' IF SUCCESSFUL
N %
S TMP="^TMP(""VEN TASK"",$J)" S @TMP="",CNT=0,U="^"
S CFIGIEN=$$CFG^VENPCCU I 'CFIGIEN D REG^VENPCCP2(10,"MISSING/INVALID CONFIGURATION") Q 0
S %=$C(68,85,90),@%@(0)=$C(64),%=$C(68,84)
S @%=$$HTFM^XLFDT($H,1)
I $P($G(^VEN(7.5,CFIGIEN,13)),U) S VER25=1 ; FLAG FOR NEW PRINT SERVICE
I $P($G(^VEN(7.5,CFIGIEN,0)),"^",12)=1 Q 0 ; BYPASS PRINTING - FOR TEST PURPOSES ONLY
S PATH=$G(^VEN(7.5,CFIGIEN,1))
I '$L(PATH) D REG^VENPCCP2(10,"Missing path to Print Folder") Q 0
S SOCKET=$P($G(^VEN(7.5,CFIGIEN,11)),U,3)
I SOCKET="" D REG^VENPCCP2(10,"Missing/Invalid Socket") Q 0
I (SOCKET<1)!(SOCKET>65535) D REG^VENPCCP2(10,"Invalid socket number") Q 0
IP S IP=$P($G(^VEN(7.5,CFIGIEN,11)),U,1) I IP="" D REG^VENPCCP2(10,"Missing IP Address") Q 0
I IP'?1.3N1P1.3N1P1.3N1P1.3N D REG^VENPCCP2(10,"Print Server #1 IP address not in the correct format") Q 0
S IPA=$P($G(^VEN(7.5,CFIGIEN,11)),U,2) I IPA="" S IPA=IP
E I IPA'?1.3N1P1.3N1P1.3N1P1.3N D REG^VENPCCP2(10,"Print Server #2 IP address not in the correct format") Q 0
I '$$OS^VENPCCU,$$VEN^VENPCCU=1 S %="S X=$"_"Z",FIRST=%_"OS(12,PF,0)",NEXT=%_"OS(13,X)",DEL=%_"OS(2,PF)"
Q 1
;
EF(MN) ; EP-GIVEN A TEMPLATE MENEMONIC, RETURN THE TEMLATE IEN
I $G(MN)="" Q ""
N EIEN,X
S EIEN=0
F S EIEN=$O(^VEN(7.41,EIEN)) Q:'EIEN S X=^(EIEN,0) I $P(X,U,3)=MN Q
Q EIEN
;
NEXT(PATH,FILE) ; EP-DISPLAY THE NEXT FILE IN A DIRECTORY, SET LASTFILE
I $L(PATH),$L(FILE)
E Q ""
N TMP
S TMP="^TMP(""VEN Z FILES"","""_$J_""")" K @TMP
D FILES^VENPCCP2(PATH,TMP) ; PUT FILES IN PRINT FOLDER INTO AN ARRAY
I $E($G(LASTFILE))="e",$D(@TMP@(LASTFILE)) D DEL(PATH,LASTFILE) K @TMP@(LASTFILE) ; CLEAR OUT NON 'Z' PREVIOUS TRYS
F S FILE=$O(@TMP@(FILE)) Q:FILE="" I FILE[".txt"!(FILE[".TXT") Q
K @TMP
S LASTFILE=FILE
Q FILE
;
COUNT(PATH) ; EP-COUNT THE TEXT FILES IN A DIRECTORY
I '$L(PATH) Q ""
N TMP,FILE,TOT
S TOT=0,FILE="A.txt"
S TMP="^TMP(""VEN Z FILES"","""_$J_""")" K @TMP
D FILES^VENPCCP2(PATH,TMP) ; PUT TXT FILES IN PRINT FOLDER INTO AN ARRAY
F S FILE=$O(@TMP@(FILE)) Q:FILE="" I FILE[".txt"!(FILE[".TXT") S TOT=TOT+1
K @TMP
Q TOT
;
CLEAN(PGIEN) ; EP-CANCELS ERROR GLOBALS
K ^TMP("VEN ERROR FLAG",1),^(4)
I $G(PGIEN) K ^TMP("VEN ERROR FLAG",2,PGIEN)
Q
;
STOP() ; EP-EXTERNAL HALT
N X S X=0
F S X=$O(^TMP("VEN TASK",X)) Q:'X I X'=$J D ; FIRST, MAKE SURE NO OTHER PRINT DEAMON PROCESSES ARE RUNNING
. K ^TMP("VEN TASK",X) ; INDIRECT WAY TO STOP ANOTHER PROCESS
. I $P($G(^VEN(7.5,$$CFG^VENPCCU,0)),U,5)=2 X ("S %=$Z"_"UTIL(4,X)") ; DIECTLY STOP ANOTHER PRINT DEAMON PROCESS ; CACHE ONLY
. Q
I $G(ERRSTOP) Q 1
I '$D(^TMP("VEN TASK",$J)) Q 1 ; CHECK PRINT DEAMON FLAG FOR CURRENT TPROCESS ; IF THE FLAG HAS BEEN KILLED, TERMINATE THIS PROCESS NOW
I ^TMP("VEN TASK",$J)["FATAL ERROR" Q 1 ; IF FATAL ERROR PRESENT, TERMINATE THIS PROCESS NOW
Q 0
;
DEL(PATH,F) ; EP-FROM VENPCC2 - DELETE A FILE FROM THE PRINT QUEUE
I $$VEN^VENPCCU=2,$$OS^VENPCCU=1 X ("I $"_"Z"_"F(-1,""rm "_PATH_F_""")") Q ; UNIX/CACHE
I $$VEN^VENPCCU=2 X ("I $"_"Z"_"F(-1,""del "_PATH_F_""")") Q ; NT/CACHE ; PATCHED BY GIS 8/29/03
I $$OS^VENPCCU D UCMD^VENPCCP("rm "_PATH_F) Q ; UNIX/MSM
N PF,X,% ; WINDOWS
S PF=PATH_F
D FUNC^VENPCCP("DEL") ; NT/MSM
Q
;
TRAP ; EP-PRINT DEAMON ERROR TRAP
S X="ERRQ^VENPCCP1",@^%ZOSF("TRAP") ; SET MUMPS ERROR TRAP AT THIS LEVEL
I $G(ERRSTOP) Q
S ERRSTOP=1
S Z=$$STOP
D CTCP^VENPCCP ; CLOSE THE TCP PORT IF NECESSARY
X ("S %=$"_"ZE")
S ERR="Print Deamon reports MUMPS-level error: "_%,MERR=1
D FILE^VENPCCP2(4,4,ERR) ; DELETES FILE AND MAKES ERROR MESSAGE
Q
;
ERRQ Q
;
VENPCCP1 ; IHS/OIT/GIS - FACILITY PRINT DEAMON ;
+1 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
+2 ;
+3 ; NEW PRINT DEAMON ; ERROR TRAPPING
+4 ; WORKS WITH NEW PRINT SERVICE
+5 ;
NEW NEW FILE,PATH,POP,REC,A,B,DFN,IP,IPA,SOCKET,%,CNT,RESULT,VISIT,SWAP,DUZ,VER25,LASTFILE
+1 NEW VENIO,X,Y,Z,I,FIRST,NEXT,DEL,TOT,TMP,MSG,WAIT,CFIGIEN,TYPE,PGIEN,MRPFLAG,DEFEF,VENDEV
+2 ; SET ERROR TRAP
SET X="TRAP^VENPCCP1"
SET @^%ZOSF("TRAP")
KILL ERRSTOP
+3 SET Y=0
+4 ; INITIALIZE LOCAL VARIABLES FROM CONFIG FILE ENTRIES
IF '$$INIT
SET %=$$STOP
QUIT
CYCLE ; EXTRNAL HALT
IF $$STOP
QUIT
+1 ; PRINT DEAMON SYNC FUNCTIONS
IF $DATA(^TMP("VEN SYNC"))
DO SYNC^VENPCCM1
KILL ^TMP("VEN SYNC")
GOTO CYCLE
INC SET CNT=CNT+1
+1 SET @TMP=("Wait cycle #"_CNT)
+2 IF $PIECE($GET(^VEN(7.5,CFIGIEN,0)),U,21)
IF $PIECE($GET(^VEN(7.5,CFIGIEN,0)),U,22)'=DT
DO CLEAN^VENPCCP3
+3 ; CHECK EMPTY DIRECTORY EVERY 5 SECONDS
HANG 5
FILE IF $$STOP
QUIT
+1 ; KEEP CYCLING IF DIRECTORY EMPTY
SET FILE=$$NEXT(PATH,"A.txt")
IF FILE=""
GOTO CYCLE
OPEN ; GET THE RECORD FROM THE DATA FILE
IF $$STOP
QUIT
REC ; IN 2.5, BUILD REC ARRAY IMMEDIATLY
IF $GET(VER25)
SET POP=$$OPN^VENPCCP(PATH,FILE,"R","D CHUNK^VENPCCP1")
IF 1
+1 ; FOR BKWD COMPATIBILITY: RETURN DATA IN THE REC STRING
IF '$TEST
SET POP=$$OPN^VENPCCP(PATH,FILE,"R","R REC")
+2 ; CAN'T OPEN DATA FILE. UNIX PERMISSIONS PROBLEM!!!
IF POP
DO DEL^VENPCCP1(PATH,FILE)
GOTO INC
+3 ; DELETE A NULL RECORD AND START OVER
IF '$LENGTH($GET(REC))
IF '$LENGTH($GET(REC(1)))
GOTO DFILE
BAL ; LOAD BALANCING
IF $LENGTH(FILE)>5
Begin DoDot:1
+1 ; GET LOAD BALANCING NUMBER
FOR I=($LENGTH(FILE)-4):-1:1
SET %=$EXTRACT(FILE,I)
IF %=+%
QUIT
+2 ; BALANCE THE LOAD
IF (+%)#2
SET %=IP
SET IP=IPA
SET IPA=%
+3 QUIT
End DoDot:1
MSG ; MONITOR MSG
SET TOT=$$COUNT(PATH)
+1 SET MSG=TOT_" file"_$SELECT(TOT>1:"s",1:"")_" in queue. Processing "_FILE
SET @TMP=MSG
TRANSMIT ; TRANSMIT THE FILE TO THE PRINT SERVER!
SET RESULT=$$SEND^VENPCCP(SOCKET,IP,IPA)
KILL REC
+1 ; EXTERNAL HALT
IF $$STOP
QUIT
BAD ; GET NEXT Z FILE
IF 'RESULT
SET FILE=$$NEXT(PATH,FILE)
IF FILE'=""
GOTO OPEN
GOTO INC
GOOD ; !!!SUCCESS!!!
+1 ; CLEAN UP ANY EXISTING ERROR FLAGS
DO CLEAN(PGIEN)
DFILE ; DELETE DATA FILE FROM PRINT DIRECTORY
DO DEL(PATH,FILE)
RECYCLE ; GET NEXT FILE
IF $EXTRACT(FILE)="Z"!($EXTRACT(FILE)="z")
GOTO FILE
+1 SET %=$EXTRACT(FILE)
SET TYPE=$SELECT(%="E":"H",%="H":"G",%="e":"h",%="h":"g",%="G":"H",%="g":"h",1:"")
+2 ; PRINT DOCUMENTS AS A GROUP IF POSSIBLE
IF $LENGTH(TYPE)
SET FILE=TYPE_$EXTRACT(FILE,2,99)
IF $$FIND^VENPCCP(PATH,FILE)
GOTO OPEN
+3 GOTO FILE
+4 ;
CHUNK ; EP - REBUILD THE RECORD IN SMALL CHUNKS THAT WILL FIT THRU THE "OPEN" WINDOW.
+1 ; THIS CODE ADDED TO AVOID THE MAXSTG AND STKOVR ERRORS EXPERIENCED UNDER VER 2.2
+2 NEW I,%,X
+3 FOR I=1:1
READ %:10
IF '$LENGTH(%)
QUIT
Begin DoDot:1
+4 ; STRIP OFF <RETURN> FROM END OF THE RECORD
FOR X=10,13
SET %=$TRANSLATE(%,$CHAR(X),"")
+5 SET REC(I)=%
+6 QUIT
End DoDot:1
+7 QUIT
+8 ;
+9 ; -----------------------------------------------
+10 ;
+11 ; NEW GENERIC FUNCTIONS FOR PRINT DEAMON
+12 ;
INIT() ; EP-INITIALIZE VARIABLES AND RETURN '1' IF SUCCESSFUL
+1 NEW %
+2 SET TMP="^TMP(""VEN TASK"",$J)"
SET @TMP=""
SET CNT=0
SET U="^"
+3 SET CFIGIEN=$$CFG^VENPCCU
IF 'CFIGIEN
DO REG^VENPCCP2(10,"MISSING/INVALID CONFIGURATION")
QUIT 0
+4 SET %=$CHAR(68,85,90)
SET @%@(0)=$CHAR(64)
SET %=$CHAR(68,84)
+5 SET @%=$$HTFM^XLFDT($HOROLOG,1)
+6 ; FLAG FOR NEW PRINT SERVICE
IF $PIECE($GET(^VEN(7.5,CFIGIEN,13)),U)
SET VER25=1
+7 ; BYPASS PRINTING - FOR TEST PURPOSES ONLY
IF $PIECE($GET(^VEN(7.5,CFIGIEN,0)),"^",12)=1
QUIT 0
+8 SET PATH=$GET(^VEN(7.5,CFIGIEN,1))
+9 IF '$LENGTH(PATH)
DO REG^VENPCCP2(10,"Missing path to Print Folder")
QUIT 0
+10 SET SOCKET=$PIECE($GET(^VEN(7.5,CFIGIEN,11)),U,3)
+11 IF SOCKET=""
DO REG^VENPCCP2(10,"Missing/Invalid Socket")
QUIT 0
+12 IF (SOCKET<1)!(SOCKET>65535)
DO REG^VENPCCP2(10,"Invalid socket number")
QUIT 0
IP SET IP=$PIECE($GET(^VEN(7.5,CFIGIEN,11)),U,1)
IF IP=""
DO REG^VENPCCP2(10,"Missing IP Address")
QUIT 0
+1 IF IP'?1.3N1P1.3N1P1.3N1P1.3N
DO REG^VENPCCP2(10,"Print Server #1 IP address not in the correct format")
QUIT 0
+2 SET IPA=$PIECE($GET(^VEN(7.5,CFIGIEN,11)),U,2)
IF IPA=""
SET IPA=IP
+3 IF '$TEST
IF IPA'?1.3N1P1.3N1P1.3N1P1.3N
DO REG^VENPCCP2(10,"Print Server #2 IP address not in the correct format")
QUIT 0
+4 IF '$$OS^VENPCCU
IF $$VEN^VENPCCU=1
SET %="S X=$"_"Z"
SET FIRST=%_"OS(12,PF,0)"
SET NEXT=%_"OS(13,X)"
SET DEL=%_"OS(2,PF)"
+5 QUIT 1
+6 ;
EF(MN) ; EP-GIVEN A TEMPLATE MENEMONIC, RETURN THE TEMLATE IEN
+1 IF $GET(MN)=""
QUIT ""
+2 NEW EIEN,X
+3 SET EIEN=0
+4 FOR
SET EIEN=$ORDER(^VEN(7.41,EIEN))
IF 'EIEN
QUIT
SET X=^(EIEN,0)
IF $PIECE(X,U,3)=MN
QUIT
+5 QUIT EIEN
+6 ;
NEXT(PATH,FILE) ; EP-DISPLAY THE NEXT FILE IN A DIRECTORY, SET LASTFILE
+1 IF $LENGTH(PATH)
IF $LENGTH(FILE)
+2 IF '$TEST
QUIT ""
+3 NEW TMP
+4 SET TMP="^TMP(""VEN Z FILES"","""_$JOB_""")"
KILL @TMP
+5 ; PUT FILES IN PRINT FOLDER INTO AN ARRAY
DO FILES^VENPCCP2(PATH,TMP)
+6 ; CLEAR OUT NON 'Z' PREVIOUS TRYS
IF $EXTRACT($GET(LASTFILE))="e"
IF $DATA(@TMP@(LASTFILE))
DO DEL(PATH,LASTFILE)
KILL @TMP@(LASTFILE)
+7 FOR
SET FILE=$ORDER(@TMP@(FILE))
IF FILE=""
QUIT
IF FILE[".txt"!(FILE[".TXT")
QUIT
+8 KILL @TMP
+9 SET LASTFILE=FILE
+10 QUIT FILE
+11 ;
COUNT(PATH) ; EP-COUNT THE TEXT FILES IN A DIRECTORY
+1 IF '$LENGTH(PATH)
QUIT ""
+2 NEW TMP,FILE,TOT
+3 SET TOT=0
SET FILE="A.txt"
+4 SET TMP="^TMP(""VEN Z FILES"","""_$JOB_""")"
KILL @TMP
+5 ; PUT TXT FILES IN PRINT FOLDER INTO AN ARRAY
DO FILES^VENPCCP2(PATH,TMP)
+6 FOR
SET FILE=$ORDER(@TMP@(FILE))
IF FILE=""
QUIT
IF FILE[".txt"!(FILE[".TXT")
SET TOT=TOT+1
+7 KILL @TMP
+8 QUIT TOT
+9 ;
CLEAN(PGIEN) ; EP-CANCELS ERROR GLOBALS
+1 KILL ^TMP("VEN ERROR FLAG",1),^(4)
+2 IF $GET(PGIEN)
KILL ^TMP("VEN ERROR FLAG",2,PGIEN)
+3 QUIT
+4 ;
STOP() ; EP-EXTERNAL HALT
+1 NEW X
SET X=0
+2 ; FIRST, MAKE SURE NO OTHER PRINT DEAMON PROCESSES ARE RUNNING
FOR
SET X=$ORDER(^TMP("VEN TASK",X))
IF 'X
QUIT
IF X'=$JOB
Begin DoDot:1
+3 ; INDIRECT WAY TO STOP ANOTHER PROCESS
KILL ^TMP("VEN TASK",X)
+4 ; DIECTLY STOP ANOTHER PRINT DEAMON PROCESS ; CACHE ONLY
IF $PIECE($GET(^VEN(7.5,$$CFG^VENPCCU,0)),U,5)=2
XECUTE ("S %=$Z"_"UTIL(4,X)")
+5 QUIT
End DoDot:1
+6 IF $GET(ERRSTOP)
QUIT 1
+7 ; CHECK PRINT DEAMON FLAG FOR CURRENT TPROCESS ; IF THE FLAG HAS BEEN KILLED, TERMINATE THIS PROCESS NOW
IF '$DATA(^TMP("VEN TASK",$JOB))
QUIT 1
+8 ; IF FATAL ERROR PRESENT, TERMINATE THIS PROCESS NOW
IF ^TMP("VEN TASK",$JOB)["FATAL ERROR"
QUIT 1
+9 QUIT 0
+10 ;
DEL(PATH,F) ; EP-FROM VENPCC2 - DELETE A FILE FROM THE PRINT QUEUE
+1 ; UNIX/CACHE
IF $$VEN^VENPCCU=2
IF $$OS^VENPCCU=1
XECUTE ("I $"_"Z"_"F(-1,""rm "_PATH_F_""")")
QUIT
+2 ; NT/CACHE ; PATCHED BY GIS 8/29/03
IF $$VEN^VENPCCU=2
XECUTE ("I $"_"Z"_"F(-1,""del "_PATH_F_""")")
QUIT
+3 ; UNIX/MSM
IF $$OS^VENPCCU
DO UCMD^VENPCCP("rm "_PATH_F)
QUIT
+4 ; WINDOWS
NEW PF,X,%
+5 SET PF=PATH_F
+6 ; NT/MSM
DO FUNC^VENPCCP("DEL")
+7 QUIT
+8 ;
TRAP ; EP-PRINT DEAMON ERROR TRAP
+1 ; SET MUMPS ERROR TRAP AT THIS LEVEL
SET X="ERRQ^VENPCCP1"
SET @^%ZOSF("TRAP")
+2 IF $GET(ERRSTOP)
QUIT
+3 SET ERRSTOP=1
+4 SET Z=$$STOP
+5 ; CLOSE THE TCP PORT IF NECESSARY
DO CTCP^VENPCCP
+6 XECUTE ("S %=$"_"ZE")
+7 SET ERR="Print Deamon reports MUMPS-level error: "_%
SET MERR=1
+8 ; DELETES FILE AND MAKES ERROR MESSAGE
DO FILE^VENPCCP2(4,4,ERR)
+9 QUIT
+10 ;
ERRQ QUIT
+1 ;