source: FOIAVistA/tag/r/MAILMAN-XM/XMKPLQ.m@ 1233

Last change on this file since 1233 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1XMKPLQ ;ISC-SF/GMB-Post local msgs to correct queues ;07/28/2000 14:34
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; Replaces ^XMADJF0, ZTSK^XMADGO (ISC-WASH/CAP)
4GO ;
5 ; Variables provided through TASKMAN: XMHANG
6 N XMACTIVE,XMUID,XMQLIST,XMTSTAMP,XMGROUP,XMCNT,XMQUEUE,XMREC
7 I $D(ZTQUEUED) S ZTREQ="@"
8 L +^XMBPOST("POST_Mover"):1 E Q
9 I $D(ZTQUEUED) S %=$$PSET^%ZTLOAD(ZTSK)
10 S XMACTIVE=$$TSTAMP^XMXUTIL1
11 F D Q:$P($G(^XMB(1,1,0)),U,16)
12 . D GETQ(.XMQLIST) ; Get new parameters for grouping
13 . S XMTSTAMP=""
14 . F S XMTSTAMP=$O(^XMBPOST("BOX",XMTSTAMP)) Q:XMTSTAMP="" D Q:$$TSTAMP^XMXUTIL1-XMACTIVE>30
15 . . S XMGROUP=""
16 . . F S XMGROUP=$O(^XMBPOST("BOX",XMTSTAMP,XMGROUP)) Q:XMGROUP="" D
17 . . . S XMUID=0
18 . . . F S XMUID=$O(^XMBPOST("BOX",XMTSTAMP,XMGROUP,XMUID)) Q:XMUID="" S XMREC=^(XMUID) D
19 . . . . S XMCNT=+XMREC
20 . . . . S XMQUEUE=$$WHICHQ(XMQLIST(XMGROUP),XMCNT)
21 . . . . I XMGROUP="M" D
22 . . . . . D MQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC)
23 . . . . E D
24 . . . . . D RQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC)
25 . . . . D STATS(XMGROUP,XMQUEUE,XMCNT)
26 . . . . K ^XMBPOST("BOX",XMTSTAMP,XMGROUP,XMUID)
27 . I $$TSTAMP^XMXUTIL1-XMACTIVE>30 D Q
28 . . D ZTSK
29 . . S XMACTIVE=$$TSTAMP^XMXUTIL1
30 . H XMHANG
31 L -^XMBPOST("POST_Mover")
32 I $D(ZTQUEUED) D PCLEAR^%ZTLOAD(ZTSK)
33 Q
34GETQ(XMQLIST) ;
35 N X
36 S X=$G(^XMB(1,1,6))
37 S XMQLIST("M")=$P(X,U),XMQLIST("R")=$P(X,U,2)
38 Q
39WHICHQ(XMQLIST,XMCNT) ;
40 N XMQUEUE,XMQLEN
41 I XMQLIST'["," Q 1
42 S XMQLEN=$L(XMQLIST,",")
43 F XMQUEUE=1:1:$L(XMQLIST,",") Q:XMCNT<$P(XMQLIST,",",XMQUEUE)
44 Q $S(XMCNT<$P(XMQLIST,",",XMQUEUE):XMQUEUE,1:XMQUEUE+1)
45RQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC) ; Put replies into queue
46 N XMZ,XMTSQ
47 ;If the response is already in the queue, find out its Timestamp
48 ;and file the new response right next to it.
49 S XMZ=$P(XMUID,U,1)
50 S XMTSQ=$O(^XMBPOST("R",XMQUEUE,"B",XMZ,0))
51 I XMTSQ S XMTSTAMP=XMTSQ
52 E S ^XMBPOST("R",XMQUEUE,"B",XMZ,XMTSTAMP)=""
53 S ^XMBPOST("R",XMQUEUE,XMTSTAMP,XMZ,$P(XMUID,U,2))=XMREC
54 Q
55MQUEUE(XMTSTAMP,XMUID,XMQUEUE,XMREC) ; Put new & forwarded messages into queue
56 S ^XMBPOST("M",XMQUEUE,XMTSTAMP,XMUID)=XMREC
57 Q
58STATS(XMGROUP,XMQUEUE,XMCNT) ;
59 N XMSTATS
60 L +^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
61 S XMSTATS=$G(^XMBPOST(XMGROUP,XMQUEUE)),^(XMQUEUE)=($P(XMSTATS,U,1)+1)_U_($P(XMSTATS,U,2)+XMCNT)
62 L -^XMBPOST("QSTATS",XMGROUP,XMQUEUE)
63 Q
64ZTSK ; START Delivery Background Processes
65 Q:$P(^XMB(1,1,0),U,16) ;Quit if Background Filer Stop Flag
66 N XMGROUP,XMQUEUE,ZTRTN,ZTSAVE,ZTDESC
67 F XMGROUP="M","R" D ; Check each queue for messages
68 . S XMQUEUE=""
69 . F S XMQUEUE=$O(^XMBPOST(XMGROUP,XMQUEUE)) Q:XMQUEUE'>0 D
70 . . Q:$D(^XMBPOST(XMGROUP,XMQUEUE))<10 ; Quit if nothing in queue
71 . . L +^XMBPOST(XMGROUP,XMQUEUE):1 E Q ; If node locked, there is already one running
72 . . S (ZTSAVE("XMGROUP"),ZTSAVE("XMQUEUE"),ZTSAVE("XMHANG"))=""
73 . . S ZTDESC=$$EZBLD^DIALOG($S(XMGROUP="M":36230,1:36231),XMQUEUE) ; MailMan: Message/Response Delivery Queue |1|
74 . . S ZTRTN="GO^XMTDL"
75 . . D TASKIT(ZTRTN,ZTDESC,.ZTSAVE) H 0 ; Start a job, Give TaskMan a chance to start it (hang)
76 . . L -^XMBPOST(XMGROUP,XMQUEUE)
77 Q
78TASKIT(ZTRTN,ZTDESC,ZTSAVE) ;
79 N X,ZTSK,ZTQUEUED,ZTCPU,ZTDTH,ZTIO
80 I '$D(ZTCPU),$D(^XMB(1,1,0)) S X=$P(^(0),U,12) I X'="" S ZTCPU=$P(X,",",2)
81 S ZTIO="",ZTDTH=$H
82 D ^%ZTLOAD
83 Q
84JOB ;Start background filer when TaskMan can't
85JOBGO S IO="",IO(0)="" D DT^DICRW G GO^XMTDL
86 Q
87CHKQ ; Input transform for file 4.3, fields 241 and 242
88 K:$L(X)>120!($L(X)<1) X Q:'$D(X)
89 K:X'?1.N.9(1","1.N) X Q:'$D(X)
90 N I
91 F I=1:1:$L(X,",")-1 I $P(X,",",I)'<$P(X,",",I+1) K X Q
92 Q
93HELPQ ; Executable help for file 4.3, fields 241 and 242
94 ;You determine the number of delivery queues (10 max.) ...
95 N XMTEXT
96 D BLD^DIALOG(36232,"","","XMTEXT","F")
97 D MSG^DIALOG("WM","",79,"","XMTEXT")
98 Q
Note: See TracBrowser for help on using the repository browser.