XMUT5 ;ISC-SF/GMB-Check Background Filer (local delivery queues) ;02/12/2003 07:42
;;8.0;MailMan;**10,2**;Jun 28, 2002
;(WASH ISC)/CAP
;
; Entry points used by MailMan options (not covered by DBIA):
; CHECK XMMGR-CHECK-BACKGROUND-FILER
CHECK ;
N XMTEXT
;* Latest Delivery shows last user with message in mailbox.
;Meaningful for new messages, possibly meaningful for (f) forwarded messages.
;Not meaningful and not shown for responses.
D BLD^DIALOG(36222,"","","XMTEXT(""*"")","F")
D BLD^DIALOG(36219,"","","XMTEXT(""M"")","F")
D BLD^DIALOG(36220,"","","XMTEXT(""R"")","F")
I $D(ZTQUEUED)!($E($G(IOST),1,2)'="C-") D DISPLAY Q
F D DISPLAY D Q:'(Y!$D(DTOUT))
. W !
. N DIR,X,DTIME
. S DTIME=5
. S DIR(0)="Y",DIR("A")=$$EZBLD^DIALOG(36210) ; Refresh
. S DIR("B")=$$EZBLD^DIALOG(39054) ; YES
. D BLD^DIALOG(36211,"","","DIR(""?"")")
. ;Answer YES if you want the display refreshed.
. ;Answer NO if you don't.
. ;If you don't answer, the display will be refreshed every five seconds.
. D ^DIR
Q
DISPLAY ;
N XMQLIST,M,R,XMTSTAMP,XMPARM
W !!,$$EZBLD^DIALOG(36212,$$FMTE^XLFDT($$NOW^XLFDT,5)),! ; Delivery Queue Status as of
S M=$G(^XMBPOST("STATS","M")),R=$G(^("R"))
I M+R>0 D
. S XMPARM(1)=M+R,XMPARM(2)=M,XMPARM(3)=R
. W !,$$EZBLD^DIALOG(36213,.XMPARM) ; Deliveries COMPLETED since last 1/2 hour: _M+R_ (_M_ Msg, _R_ Resp)
D GO^XMUT5B
D GETQ^XMKPLQ(.XMQLIST)
S XMPARM(1)=$S(XMQLIST("M")="":1,1:$L(XMQLIST("M"),",")+1)
S XMPARM(2)=$S(XMQLIST("R")="":1,1:$L(XMQLIST("R"),",")+1)
W !,$$EZBLD^DIALOG(36214,.XMPARM) ; Number of delivery queues: |1| Message and |2| Response
S XMTSTAMP=$O(^XMBPOST("BOX",0))
I XMTSTAMP W !,$$EZBLD^DIALOG(36215,$$WAITIME(XMTSTAMP)) ; Waiting time for items to be put in the delivery queues:
E W !,$$EZBLD^DIALOG(36216) ; Nothing waiting to be put in the delivery queues.
I M("T")+R("T")<1 W !!,$$EZBLD^DIALOG(36217) ; Nothing in the delivery queues.
E D
. W !,$$EZBLD^DIALOG(36218,M("T")+R("T")) ; Items currently waiting in delivery queues:
. I M("T")>0 D SHOWQ("M",.M,XMQLIST("M"))
. I R("T")>0 D SHOWQ("R",.R,XMQLIST("R"))
. I M("T") D MSG^DIALOG("SWM","",80,"","XMTEXT(""*"")")
D SHOWFILR
Q
SHOWQ(XMGROUP,Q,XMQLIST) ;
D MSG^DIALOG("SWM","",80,"","XMTEXT(XMGROUP)")
N I,XMCNT
S XMCNT=0
F I=1:1:10 I Q("O",I) D
. S XMCNT=XMCNT+1
. W !,$J(I,2)," ",$$QRANGE(XMQLIST,I)
. W ?17,$J(+Q("O",I),7),?27,$J($P(Q("O",I),U,3),8),?39,$J($$WAITIME($P(Q("O",I),U,2)),12),$J($P(Q("O",I),U,4),16),$J($P(Q("O",I),U,5),3),$J($P(Q("O",I),U,6),9)
I XMCNT>1 W !,?3,$$EZBLD^DIALOG(36221),?17,$J(+Q("T"),7),?27,$J($P(Q("T"),U,3),8),?39,$J($$WAITIME($P(Q("T"),U,2)),12) ; Summary
Q
SHOWFILR ;
N XMSTATUS,I
D STATUS^XMKPL(.XMSTATUS)
W !!,$$EZBLD^DIALOG(36224) ; Background filer status:
I $D(XMSTATUS)<10 D
. W $$EZBLD^DIALOG(36225) ; ALL Background Delivery jobs are RUNNING.
E D
. I $P(^XMB(1,1,0),U,16) D
. . N XMTEXT ; The Background Filers have been shut down.
. . D BLD^DIALOG(36226,"","","XMTEXT","F")
. . D MSG^DIALOG("SWM","",80,"","XMTEXT")
. W !
. S I=""
. F S I=$O(XMSTATUS(I)) Q:I="" W !,XMSTATUS(I)
Q
QRANGE(XMQLIST,I) ; Queue range
I XMQLIST="" Q "(...)"
I I=1 Q "<"_+XMQLIST
I I>$L(XMQLIST,",") Q $P(XMQLIST,",",I-1)_"+"
Q $P(XMQLIST,",",I-1)_"-"_($P(XMQLIST,",",I)-1)
WAITIME(X) ;
N XMDIFF,XMWAIT
S XMDIFF=$$TSTAMP^XMXUTIL1-X
S XMWAIT=""
S:XMDIFF'<86400 XMWAIT=(XMDIFF\86400)_" "
S:XMDIFF#86400 XMWAIT=XMWAIT_(XMDIFF#86400\3600)_":"_$E(XMDIFF#3600\60+100,2,3)_":"_$E(XMDIFF#60+100,2,3)
Q XMWAIT
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMUT5 3590 printed Dec 13, 2024@02:13:36 Page 2
XMUT5 ;ISC-SF/GMB-Check Background Filer (local delivery queues) ;02/12/2003 07:42
+1 ;;8.0;MailMan;**10,2**;Jun 28, 2002
+2 ;(WASH ISC)/CAP
+3 ;
+4 ; Entry points used by MailMan options (not covered by DBIA):
+5 ; CHECK XMMGR-CHECK-BACKGROUND-FILER
CHECK ;
+1 NEW XMTEXT
+2 ;* Latest Delivery shows last user with message in mailbox.
+3 ;Meaningful for new messages, possibly meaningful for (f) forwarded messages.
+4 ;Not meaningful and not shown for responses.
+5 DO BLD^DIALOG(36222,"","","XMTEXT(""*"")","F")
+6 DO BLD^DIALOG(36219,"","","XMTEXT(""M"")","F")
+7 DO BLD^DIALOG(36220,"","","XMTEXT(""R"")","F")
+8 IF $DATA(ZTQUEUED)!($EXTRACT($GET(IOST),1,2)'="C-")
DO DISPLAY
QUIT
+9 FOR
DO DISPLAY
Begin DoDot:1
+10 WRITE !
+11 NEW DIR,X,DTIME
+12 SET DTIME=5
+13 ; Refresh
SET DIR(0)="Y"
SET DIR("A")=$$EZBLD^DIALOG(36210)
+14 ; YES
SET DIR("B")=$$EZBLD^DIALOG(39054)
+15 DO BLD^DIALOG(36211,"","","DIR(""?"")")
+16 ;Answer YES if you want the display refreshed.
+17 ;Answer NO if you don't.
+18 ;If you don't answer, the display will be refreshed every five seconds.
+19 DO ^DIR
End DoDot:1
if '(Y!$DATA(DTOUT))
QUIT
+20 QUIT
DISPLAY ;
+1 NEW XMQLIST,M,R,XMTSTAMP,XMPARM
+2 ; Delivery Queue Status as of
WRITE !!,$$EZBLD^DIALOG(36212,$$FMTE^XLFDT($$NOW^XLFDT,5)),!
+3 SET M=$GET(^XMBPOST("STATS","M"))
SET R=$GET(^("R"))
+4 IF M+R>0
Begin DoDot:1
+5 SET XMPARM(1)=M+R
SET XMPARM(2)=M
SET XMPARM(3)=R
+6 ; Deliveries COMPLETED since last 1/2 hour: _M+R_ (_M_ Msg, _R_ Resp)
WRITE !,$$EZBLD^DIALOG(36213,.XMPARM)
End DoDot:1
+7 DO GO^XMUT5B
+8 DO GETQ^XMKPLQ(.XMQLIST)
+9 SET XMPARM(1)=$SELECT(XMQLIST("M")="":1,1:$LENGTH(XMQLIST("M"),",")+1)
+10 SET XMPARM(2)=$SELECT(XMQLIST("R")="":1,1:$LENGTH(XMQLIST("R"),",")+1)
+11 ; Number of delivery queues: |1| Message and |2| Response
WRITE !,$$EZBLD^DIALOG(36214,.XMPARM)
+12 SET XMTSTAMP=$ORDER(^XMBPOST("BOX",0))
+13 ; Waiting time for items to be put in the delivery queues:
IF XMTSTAMP
WRITE !,$$EZBLD^DIALOG(36215,$$WAITIME(XMTSTAMP))
+14 ; Nothing waiting to be put in the delivery queues.
IF '$TEST
WRITE !,$$EZBLD^DIALOG(36216)
+15 ; Nothing in the delivery queues.
IF M("T")+R("T")<1
WRITE !!,$$EZBLD^DIALOG(36217)
+16 IF '$TEST
Begin DoDot:1
+17 ; Items currently waiting in delivery queues:
WRITE !,$$EZBLD^DIALOG(36218,M("T")+R("T"))
+18 IF M("T")>0
DO SHOWQ("M",.M,XMQLIST("M"))
+19 IF R("T")>0
DO SHOWQ("R",.R,XMQLIST("R"))
+20 IF M("T")
DO MSG^DIALOG("SWM","",80,"","XMTEXT(""*"")")
End DoDot:1
+21 DO SHOWFILR
+22 QUIT
SHOWQ(XMGROUP,Q,XMQLIST) ;
+1 DO MSG^DIALOG("SWM","",80,"","XMTEXT(XMGROUP)")
+2 NEW I,XMCNT
+3 SET XMCNT=0
+4 FOR I=1:1:10
IF Q("O",I)
Begin DoDot:1
+5 SET XMCNT=XMCNT+1
+6 WRITE !,$JUSTIFY(I,2)," ",$$QRANGE(XMQLIST,I)
+7 WRITE ?17,$JUSTIFY(+Q("O",I),7),?27,$JUSTIFY($PIECE(Q("O",I),U,3),8),?39,$JUSTIFY($$WAITIME($PIECE(Q("O",I),U,2)),12),$JUSTIFY($PIECE(Q("O",I),U,4),16),$JUSTIFY($PIECE(Q("O",I),U,5),3),$JUSTIFY($PIECE(Q("O",I),U,6),9)
End DoDot:1
+8 ; Summary
IF XMCNT>1
WRITE !,?3,$$EZBLD^DIALOG(36221),?17,$JUSTIFY(+Q("T"),7),?27,$JUSTIFY($PIECE(Q("T"),U,3),8),?39,$JUSTIFY($$WAITIME($PIECE(Q("T"),U,2)),12)
+9 QUIT
SHOWFILR ;
+1 NEW XMSTATUS,I
+2 DO STATUS^XMKPL(.XMSTATUS)
+3 ; Background filer status:
WRITE !!,$$EZBLD^DIALOG(36224)
+4 IF $DATA(XMSTATUS)<10
Begin DoDot:1
+5 ; ALL Background Delivery jobs are RUNNING.
WRITE $$EZBLD^DIALOG(36225)
End DoDot:1
+6 IF '$TEST
Begin DoDot:1
+7 IF $PIECE(^XMB(1,1,0),U,16)
Begin DoDot:2
+8 ; The Background Filers have been shut down.
NEW XMTEXT
+9 DO BLD^DIALOG(36226,"","","XMTEXT","F")
+10 DO MSG^DIALOG("SWM","",80,"","XMTEXT")
End DoDot:2
+11 WRITE !
+12 SET I=""
+13 FOR
SET I=$ORDER(XMSTATUS(I))
if I=""
QUIT
WRITE !,XMSTATUS(I)
End DoDot:1
+14 QUIT
QRANGE(XMQLIST,I) ; Queue range
+1 IF XMQLIST=""
QUIT "(...)"
+2 IF I=1
QUIT "<"_+XMQLIST
+3 IF I>$LENGTH(XMQLIST,",")
QUIT $PIECE(XMQLIST,",",I-1)_"+"
+4 QUIT $PIECE(XMQLIST,",",I-1)_"-"_($PIECE(XMQLIST,",",I)-1)
WAITIME(X) ;
+1 NEW XMDIFF,XMWAIT
+2 SET XMDIFF=$$TSTAMP^XMXUTIL1-X
+3 SET XMWAIT=""
+4 if XMDIFF'<86400
SET XMWAIT=(XMDIFF\86400)_" "
+5 if XMDIFF#86400
SET XMWAIT=XMWAIT_(XMDIFF#86400\3600)_":"_$EXTRACT(XMDIFF#3600\60+100,2,3)_":"_$EXTRACT(XMDIFF#60+100,2,3)
+6 QUIT XMWAIT