VENPCCMX ; IHS/OIT/GIS - PRINT DEAMON MONITOR 12 Feb 2004 10:12 AM ;
;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
;
;
;
MON ; EP-MONITOR THE PRINT DEAMON
N %,STOP,LAST,TOT
S %=+$O(^TMP("VEN TASK",0)),LAST=$G(^TMP("VEN TASK",%))
I '$D(^TMP("VEN TASK")) G:$$MSG(1) RPT Q
W !,"The Print Deamon is being monitored"
RPT W !!
F TOT=1:1 Q:$G(STOP) D
. S %=$O(^TMP("VEN TASK",0)) I '% D Q
.. S STOP=1
.. S %=$O(^VEN(7.7,999999999),-1) I '% Q
.. I '$P($G(^VEN(7.7,%,0)),U,6) W !,"Print Deamon encountered an error: ",$G(^(1))
.. Q
. S %=^TMP("VEN TASK",%) I %="" S STOP=1 Q
. I TOT=60,%=LAST W !,"The Print Deamon appears to be stuck!",!,"It will be shut down now..." D KILLTASK^VENPCCP S STOP=1 Q
. I TOT=60 S TOT=1,LAST=%
. W $C(13),?70,$C(13)
. W %
. R %:1 E Q
. I %="^^" W !,"The Print Deamon has been stopped!" D KILLTASK^VENPCCP S STOP=1 Q
. I %="" S STOP=1 Q
. Q
Q
;
MSG(STATE) ; EP - START THE PRINT DEAMON MSG
N %,%Y
I $G(STATE) D
. W !,"The Print Deamon does not appear to be running at this time!"
. S %=$O(^VEN(7.7,999999999),-1) I '% Q
. I '$P($G(^VEN(7.7,%,0)),U,6) W !,"It stopped with this error: ",$G(^(1))
. Q
W !,"Want to start the Print Deamon now"
S %=1 D YN^DICN I %'=1 Q 0
I $D(^TMP("VEN TASK")) W !,"Print Deamon has been started!" Q 1
X ("J "_U_"VENPCCP")
W !,"Attempting to start the Print Deamon... Please wait"
H 3
I $D(^TMP("VEN TASK")) W !,"Print Deamon has been started!" Q 1
W !,"Unable to start the Print Deamon! Notify site manager..."
Q 0
;
STOP ; EP-STOP THE PRINT DEAMON
I '$D(^TMP("VEN TASK")) W !,"The print deamon is not running at this time!" Q
N %,%Y,CFIGIEN,PATH
S CFIGIEN=$$CFG^VENPCCU
S PATH=$G(^VEN(7.5,CFIGIEN,1))
S %=$$COUNT^VENPCCP(PATH)
I %=1 W !,"There is one file waiting to be processed by the Print Deamon" G SS
I '% S %="no"
W !,"There are ",%," files waiting to be processed by the Print Deamon"
SS W !,"Want to stop the Print Deamon now"
S %=1 D YN^DICN I %'=1 Q
D KILLTASK^VENPCCP K ^TMP("VEN ERROR FLAG")
S1 W !,"The Print Deamon has been stopped!"
Q
;
START ; EP-START THE PRINT DEAMON
I $$MSG(0)
Q
;
RESTART ; EP-CLEAN OUT THE PRINT DIRECTORY AND RESTART THE PRINT DEAMON
W !,"WARNING!!!",!,"This option will erase all files in the print queue and reset the system"
W !,"Want to proceed" S %=2 D YN^DICN I %'=1 Q
N PATH,F,CFIGIEN,%
S PATH=$G(^VEN(7.5,+$$CFG^VENPCCU,1)) I '$L(PATH) W !,"Unable to find path in config file!. Request terminated.",!! Q
S F="*.txt"
D DEL^VENPCCP(PATH,F) W !,"The Print Directory has been cleaned out.",!!
D KILLTASK^VENPCCP K ^TMP("VEN ERROR FLAG")
I $$MSG(0)
Q
;
AUTO ; EP-AUTOMATICALLY START PCC PLUS PRINT DEAMON
D KILLTASK^VENPCCP K ^TMP("VEN ERROR FLAG")
X ("J "_U_"VENPCCP")
Q
;
VENPCCMX ; IHS/OIT/GIS - PRINT DEAMON MONITOR 12 Feb 2004 10:12 AM ;
+1 ;;2.6;PCC+;**1,3**;APR 03, 2012;Build 24
+2 ;
+3 ;
+4 ;
MON ; EP-MONITOR THE PRINT DEAMON
+1 NEW %,STOP,LAST,TOT
+2 SET %=+$ORDER(^TMP("VEN TASK",0))
SET LAST=$GET(^TMP("VEN TASK",%))
+3 IF '$DATA(^TMP("VEN TASK"))
IF $$MSG(1)
GOTO RPT
QUIT
+4 WRITE !,"The Print Deamon is being monitored"
RPT WRITE !!
+1 FOR TOT=1:1
IF $GET(STOP)
QUIT
Begin DoDot:1
+2 SET %=$ORDER(^TMP("VEN TASK",0))
IF '%
Begin DoDot:2
+3 SET STOP=1
+4 SET %=$ORDER(^VEN(7.7,999999999),-1)
IF '%
QUIT
+5 IF '$PIECE($GET(^VEN(7.7,%,0)),U,6)
WRITE !,"Print Deamon encountered an error: ",$GET(^(1))
+6 QUIT
End DoDot:2
QUIT
+7 SET %=^TMP("VEN TASK",%)
IF %=""
SET STOP=1
QUIT
+8 IF TOT=60
IF %=LAST
WRITE !,"The Print Deamon appears to be stuck!",!,"It will be shut down now..."
DO KILLTASK^VENPCCP
SET STOP=1
QUIT
+9 IF TOT=60
SET TOT=1
SET LAST=%
+10 WRITE $CHAR(13),?70,$CHAR(13)
+11 WRITE %
+12 READ %:1
IF '$TEST
QUIT
+13 IF %="^^"
WRITE !,"The Print Deamon has been stopped!"
DO KILLTASK^VENPCCP
SET STOP=1
QUIT
+14 IF %=""
SET STOP=1
QUIT
+15 QUIT
End DoDot:1
+16 QUIT
+17 ;
MSG(STATE) ; EP - START THE PRINT DEAMON MSG
+1 NEW %,%Y
+2 IF $GET(STATE)
Begin DoDot:1
+3 WRITE !,"The Print Deamon does not appear to be running at this time!"
+4 SET %=$ORDER(^VEN(7.7,999999999),-1)
IF '%
QUIT
+5 IF '$PIECE($GET(^VEN(7.7,%,0)),U,6)
WRITE !,"It stopped with this error: ",$GET(^(1))
+6 QUIT
End DoDot:1
+7 WRITE !,"Want to start the Print Deamon now"
+8 SET %=1
DO YN^DICN
IF %'=1
QUIT 0
+9 IF $DATA(^TMP("VEN TASK"))
WRITE !,"Print Deamon has been started!"
QUIT 1
+10 XECUTE ("J "_U_"VENPCCP")
+11 WRITE !,"Attempting to start the Print Deamon... Please wait"
+12 HANG 3
+13 IF $DATA(^TMP("VEN TASK"))
WRITE !,"Print Deamon has been started!"
QUIT 1
+14 WRITE !,"Unable to start the Print Deamon! Notify site manager..."
+15 QUIT 0
+16 ;
STOP ; EP-STOP THE PRINT DEAMON
+1 IF '$DATA(^TMP("VEN TASK"))
WRITE !,"The print deamon is not running at this time!"
QUIT
+2 NEW %,%Y,CFIGIEN,PATH
+3 SET CFIGIEN=$$CFG^VENPCCU
+4 SET PATH=$GET(^VEN(7.5,CFIGIEN,1))
+5 SET %=$$COUNT^VENPCCP(PATH)
+6 IF %=1
WRITE !,"There is one file waiting to be processed by the Print Deamon"
GOTO SS
+7 IF '%
SET %="no"
+8 WRITE !,"There are ",%," files waiting to be processed by the Print Deamon"
SS WRITE !,"Want to stop the Print Deamon now"
+1 SET %=1
DO YN^DICN
IF %'=1
QUIT
+2 DO KILLTASK^VENPCCP
KILL ^TMP("VEN ERROR FLAG")
S1 WRITE !,"The Print Deamon has been stopped!"
+1 QUIT
+2 ;
START ; EP-START THE PRINT DEAMON
+1 IF $$MSG(0)
+2 QUIT
+3 ;
RESTART ; EP-CLEAN OUT THE PRINT DIRECTORY AND RESTART THE PRINT DEAMON
+1 WRITE !,"WARNING!!!",!,"This option will erase all files in the print queue and reset the system"
+2 WRITE !,"Want to proceed"
SET %=2
DO YN^DICN
IF %'=1
QUIT
+3 NEW PATH,F,CFIGIEN,%
+4 SET PATH=$GET(^VEN(7.5,+$$CFG^VENPCCU,1))
IF '$LENGTH(PATH)
WRITE !,"Unable to find path in config file!. Request terminated.",!!
QUIT
+5 SET F="*.txt"
+6 DO DEL^VENPCCP(PATH,F)
WRITE !,"The Print Directory has been cleaned out.",!!
+7 DO KILLTASK^VENPCCP
KILL ^TMP("VEN ERROR FLAG")
+8 IF $$MSG(0)
+9 QUIT
+10 ;
AUTO ; EP-AUTOMATICALLY START PCC PLUS PRINT DEAMON
+1 DO KILLTASK^VENPCCP
KILL ^TMP("VEN ERROR FLAG")
+2 XECUTE ("J "_U_"VENPCCP")
+3 QUIT
+4 ;