XMKPL ;ISC-SF/GMB-Manage the local mail posting process ;04/17/2002 10:54
;;8.0;MailMan;;Jun 28, 2002
; Replaces ^XMADGO1,^XMADGO (ISC-WASH/CAP)
; Entry points (not covered by DBIA):
; CHECK Check the local processes.
; If they haven't been deliberately STOP'd,
; and if they are not running,
; then task them.
; STATUS Get status of local processes.
;
; Entry points used by MailMan options (not covered by DBIA):
; STOP XMMGR-STOP-BACKGROUND-FILER - Stop the local processes.
; START XMMGR-START-BACKGROUND-FILER - Start the local processes.
;
CHECK ; Task Background Filer processes if any missing
Q:$P(^XMB(1,1,0),U,16) ; Quit if 'background filer stop flag' set.
N XMPROC,XMSTATUS
D STATUS(.XMSTATUS)
Q:'$D(XMSTATUS)
S XMPROC=""
F S XMPROC=$O(XMSTATUS(XMPROC)) Q:XMPROC="" D QUEUE(XMPROC)
Q
STATUS(XMSTATUS) ;Check status of background filer
N XMPROC,XMLOCK
F XMPROC="Mover","Tickler" D
. S XMLOCK="POST_"_XMPROC
. L +^XMBPOST(XMLOCK):0 E Q
. S XMSTATUS(XMPROC)=$$EZBLD^DIALOG($S(XMPROC="Mover":36224.1,1:36224.2)) ; The Mover/Tickler is not running!
. L -^XMBPOST(XMLOCK)
Q
QUEUE(XMPROC) ;Start Queue processors
N XMHANG,ZTRTN,ZTDESC,ZTSAVE,X,ZTSK,ZTQUEUED,ZTCPU,ZTDTH,ZTIO
S XMHANG=$$HANG
S ZTDESC=$$EZBLD^DIALOG($S(XMPROC="Mover":36227,1:36228)) ; MailMan: Background Filer (Mover/Tickler)
S ZTSAVE("XMHANG")=""
S ZTRTN=$S(XMPROC="Mover":"GO^XMKPLQ",1:"GO^XMTDT")
I $D(^XMB(1,1,0)) S X=$P(^(0),U,12) I X'="" S ZTCPU=$P(X,",",2)
S ZTIO="",ZTDTH=$H
D ^%ZTLOAD
Q
HANG() ; Get Hangtime for delivery modules
N X
S X=$P($G(^XMB(1,1,0)),U,13)
Q $S(X:X,1:5)
STOP ; Stop Background mail delivery processes
N DIR,Y,DIRUT
S DIR(0)="Y"
D BLD^DIALOG(36229,"","","DIR(""A"")")
;Are you sure you want the Background Filers to stop delivering mail
S DIR("B")=$$EZBLD^DIALOG(39053) ; No
D ^DIR Q:'Y
S $P(^XMB(1,1,0),U,16)=1 ; Set 'background filer stop flag'
W:'$D(ZTQUEUED) !!,$C(7),$$EZBLD^DIALOG(36229.1) ; << Background Filers will stop soon. >>
Q
START ; Start the local processes (usually after they had been STOP'd).
S $P(^XMB(1,1,0),U,16)="" ; Reset 'background filer stop flag'
D CHECK
W:'$D(ZTQUEUED) !!,$C(7),$$EZBLD^DIALOG(36229.2) ; << Background Filers will start soon. >>
Q
XMKPL ;ISC-SF/GMB-Manage the local mail posting process ;04/17/2002 10:54
+1 ;;8.0;MailMan;;Jun 28, 2002
+2 ; Replaces ^XMADGO1,^XMADGO (ISC-WASH/CAP)
+3 ; Entry points (not covered by DBIA):
+4 ; CHECK Check the local processes.
+5 ; If they haven't been deliberately STOP'd,
+6 ; and if they are not running,
+7 ; then task them.
+8 ; STATUS Get status of local processes.
+9 ;
+10 ; Entry points used by MailMan options (not covered by DBIA):
+11 ; STOP XMMGR-STOP-BACKGROUND-FILER - Stop the local processes.
+12 ; START XMMGR-START-BACKGROUND-FILER - Start the local processes.
+13 ;
CHECK ; Task Background Filer processes if any missing
+1 ; Quit if 'background filer stop flag' set.
IF $PIECE(^XMB(1,1,0),U,16)
QUIT
+2 NEW XMPROC,XMSTATUS
+3 DO STATUS(.XMSTATUS)
+4 IF '$DATA(XMSTATUS)
QUIT
+5 SET XMPROC=""
+6 FOR
SET XMPROC=$ORDER(XMSTATUS(XMPROC))
IF XMPROC=""
QUIT
DO QUEUE(XMPROC)
+7 QUIT
STATUS(XMSTATUS) ;Check status of background filer
+1 NEW XMPROC,XMLOCK
+2 FOR XMPROC="Mover","Tickler"
Begin DoDot:1
+3 SET XMLOCK="POST_"_XMPROC
+4 LOCK +^XMBPOST(XMLOCK):0
IF '$TEST
QUIT
+5 ; The Mover/Tickler is not running!
SET XMSTATUS(XMPROC)=$$EZBLD^DIALOG($SELECT(XMPROC="Mover":36224.1,1:36224.2))
+6 LOCK -^XMBPOST(XMLOCK)
End DoDot:1
+7 QUIT
QUEUE(XMPROC) ;Start Queue processors
+1 NEW XMHANG,ZTRTN,ZTDESC,ZTSAVE,X,ZTSK,ZTQUEUED,ZTCPU,ZTDTH,ZTIO
+2 SET XMHANG=$$HANG
+3 ; MailMan: Background Filer (Mover/Tickler)
SET ZTDESC=$$EZBLD^DIALOG($SELECT(XMPROC="Mover":36227,1:36228))
+4 SET ZTSAVE("XMHANG")=""
+5 SET ZTRTN=$SELECT(XMPROC="Mover":"GO^XMKPLQ",1:"GO^XMTDT")
+6 IF $DATA(^XMB(1,1,0))
SET X=$PIECE(^(0),U,12)
IF X'=""
SET ZTCPU=$PIECE(X,",",2)
+7 SET ZTIO=""
SET ZTDTH=$HOROLOG
+8 DO ^%ZTLOAD
+9 QUIT
HANG() ; Get Hangtime for delivery modules
+1 NEW X
+2 SET X=$PIECE($GET(^XMB(1,1,0)),U,13)
+3 QUIT $SELECT(X:X,1:5)
STOP ; Stop Background mail delivery processes
+1 NEW DIR,Y,DIRUT
+2 SET DIR(0)="Y"
+3 DO BLD^DIALOG(36229,"","","DIR(""A"")")
+4 ;Are you sure you want the Background Filers to stop delivering mail
+5 ; No
SET DIR("B")=$$EZBLD^DIALOG(39053)
+6 DO ^DIR
IF 'Y
QUIT
+7 ; Set 'background filer stop flag'
SET $PIECE(^XMB(1,1,0),U,16)=1
+8 ; << Background Filers will stop soon. >>
IF '$DATA(ZTQUEUED)
WRITE !!,$CHAR(7),$$EZBLD^DIALOG(36229.1)
+9 QUIT
START ; Start the local processes (usually after they had been STOP'd).
+1 ; Reset 'background filer stop flag'
SET $PIECE(^XMB(1,1,0),U,16)=""
+2 DO CHECK
+3 ; << Background Filers will start soon. >>
IF '$DATA(ZTQUEUED)
WRITE !!,$CHAR(7),$$EZBLD^DIALOG(36229.2)
+4 QUIT