source: FOIAVistA/trunk/r/MAILMAN-XM/XMTDR.m@ 1608

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

initial load of FOIAVistA 6/30/08 version

File size: 6.4 KB
Line 
1XMTDR ;ISC-SF/GMB-Transmit messages in a queue ;08/28/2003 09:22
2 ;;8.0;MailMan;**22**;Jun 28, 2002
3PLAY(XMINST,XMSITE,XMB) ;
4 N XMIO,XMTLER,XM,XMTURN
5 S:'$D(ZTQUEUED) XM="D"
6 S XMIO=$P(XMB("SCR REC"),U,5)
7 D ENT^XMC1
8 Q
9TASK ; Task Manager comes here to send message to remote site
10 ; (Tasked by QUEUE^XMKPR or REQUEUE^XMKPR)
11 ; Was ZTSK^XMS0 (ISC-WASH/THM/CAP)
12 ; Variables supplied by TaskMan:
13 ; XMINST Institution number
14 ; XMPOLL Are we polling? 0=no; 1=yes
15 ;
16 ; Variables used here:
17 ; XMSITE Institution name
18 ; XMIO same as ZTIO
19 ; XMB("SCR IEN") Points to which script for XMINST in ^DIC(4.2 to use
20 ; XMB("SCR REC") The script record
21 ; XMB("TRIES") # of tries
22 I '$D(XMINST) S XMINST=XMB("XMSCR") K XMB ; Transition: v7.1 to v8.0
23 S ZTREQ="@"
24 Q:$$OBE(XMINST)
25 I '$$NEXT^XMS(XMINST+1000),'$G(XMPOLL) D XMTFINIS(XMINST) Q
26 N XMB,XMC,XMSITE,XM,XMIO
27 S XM=$G(XM)
28 S XMIO=ZTIO
29 S XMSITE=$P(^DIC(4.2,XMINST,0),U,1)
30 D XMTGET(XMINST,.XMB)
31 D XMTAUDT(XMINST,.XMB)
32 I XMB("TRIES")+1=$P(XMB("SCR REC"),U,3) D GET^XMCXT(1) ; Record transcript
33 D ENT^XMC1
34 I $G(ER),'$G(XMPOLL),'$G(XMC("NOREQUEUE")) D REQUEUE^XMKPR(XMINST,XMSITE,.XMB) Q
35 D XMTFINIS(XMINST)
36 I $G(XMC("S"))!$G(XMC("R")) D CHKSETIP(XMINST,XMSITE,.XMB)
37 Q
38CHKSETIP(XMINST,XMSITE,XMB) ;
39 N XMOLDIP,XMIP,XMIENS,XMTXT,XMPARM
40 S XMIP=$P(XMB("SCR REC"),U,6) Q:XMIP=""
41 S XMIENS=XMINST_","
42 ;I $P(^DIC(4.2,XMINST,0),U,12)'=XMIP D
43 ;. S XMFDA(4.2,XMIENS,6.5)=XMIP ; successful IP address
44 ;. D FILE^DIE("","XMFDA")
45 Q:+XMB("SCR IEN")'=XMB("SCR IEN")!'XMB("SCR IEN")
46 S XMOLDIP=$P(^DIC(4.2,XMINST,1,XMB("SCR IEN"),0),U,6)
47 Q:XMOLDIP=XMIP
48 I $$FIND1^DIC(4.2,"","MQX",XMC("HELO SEND"),"B^C")'=XMINST D Q
49 . Q:'$G(XMC("PLAY"))!$D(ZTQUEUED)
50 . ;We will not change the IP address in the script because the site
51 . ;self-identifed as |1|, which is not |2| or any of its synonyms.
52 . N XMPARM,XMTEXT
53 . S XMPARM(1)=XMC("HELO SEND"),XMPARM(2)=XMSITE
54 . D BLD^DIALOG(42269,.XMPARM,"","XMTEXT","F")
55 . D MSG^DIALOG("WM","","","","XMTEXT")
56 S XMIENS=XMB("SCR IEN")_","_XMIENS
57 S XMFDA(4.21,XMIENS,1.4)=XMIP ; successful IP address
58 D FILE^DIE("","XMFDA")
59 S XMPARM(1)=XMOLDIP,XMPARM(2)=XMIP,XMPARM(3)=$$MMDT^XMXUTIL1($$NOW^XLFDT)
60 I $G(XMC("PLAY")),'$D(ZTQUEUED) W !,$$EZBLD^DIALOG(42267,.XMPARM) ;Changed IP address in script from '|1|' to '|2|'
61 S XMTXT(1,0)=$$EZBLD^DIALOG(42268,.XMPARM) ;|3| - Changed IP address from '|1|' to '|2|' (MailMan)
62 D WP^DIE(4.21,XMIENS,99,"A","XMTXT") ; Add line to script notes
63 Q
64OBE(XMINST) ; Overcome by Events?
65 N XMTSK
66 S XMTSK=+$$TSKEXIST^XMKPR(XMINST)
67 I XMTSK,ZTSK'=XMTSK Q 1
68 Q 0
69XMTGET(XMINST,XMB) ;
70 N XMTREC
71 L +^XMBS(4.2999,XMINST,4):0 L -^XMBS(4.2999,XMINST,4) ; ensure latest
72 S XMTREC=^XMBS(4.2999,XMINST,4)
73 S XMB("SCR IEN")=$P(XMTREC,U,3)
74 S XMB("TRIES")=$P(XMTREC,U,4)
75 S XMB("ITERATIONS")=$P(XMTREC,U,6)
76 S XMB("FIRST SCRIPT")=$P(XMTREC,U,7)
77 S XMB("IP TRIED")=$P(XMTREC,U,8)
78 S XMB("SCR REC")=^XMBS(4.2999,XMINST,5)
79 Q
80XMTAUDT(XMINST,XMB) ;
81 N XMTREC,XMFDA,XMIENS,XMIEN,XMNOW
82 L +^XMBS(4.2999,XMINST)
83 S XMNOW=$$NOW^XLFDT
84 S XMIENS=XMINST_","
85 S XMFDA(4.2999,XMIENS,1)="@" ; current time
86 S XMFDA(4.2999,XMIENS,2)="@" ; msg in transit
87 S XMFDA(4.2999,XMIENS,3)="@" ; line last transmitted
88 S XMFDA(4.2999,XMIENS,4)="@" ; errors this transmission
89 S XMFDA(4.2999,XMIENS,5)="@" ; rate of transmission
90 S XMFDA(4.2999,XMIENS,6)="@" ; device
91 S XMTREC=^XMBS(4.2999,XMINST,4)
92 I '$P(XMTREC,U,1)!$P(XMTREC,U,2) D
93 . ; There's no start time or there is a finish time, so start audit anew
94 . K ^XMBS(4.2999,XMINST,6) ; kill off the audit multiple
95 . S XMFDA(4.2999,XMIENS,41)=XMNOW ; start time
96 . S XMFDA(4.2999,XMIENS,42)="@" ; finish time
97 S XMFDA(4.2999,XMIENS,45)=XMNOW ; latest try time
98 D FILE^DIE("","XMFDA")
99 K XMFDA
100 S XMFDA(4.29992,"+1,"_XMIENS,.01)=XMNOW ; audit try time
101 S XMFDA(4.29992,"+1,"_XMIENS,1)=$E($P(XMB("SCR REC"),U),1,10) ; audit script name
102 S XMFDA(4.29992,"+1,"_XMIENS,3)=$E($P(XMB("SCR REC"),U,6),1,20) ; audit IP address
103 D UPDATE^DIE("","XMFDA","XMIEN")
104 L -^XMBS(4.2999,XMINST)
105 S XMB("AUDIT IENS")=XMIEN(1)_","_XMIENS
106 Q
107XMTFINIS(XMINST) ;
108 N XMFDA,XMIENS
109 L +^XMBS(4.2999,XMINST)
110 K ^XMBS(4.2999,XMINST,3) ; current xmit stats
111 ;K ^XMBS(4.2999,XMINST,4) ; latest xmit info (don't delete)
112 ;K ^XMBS(4.2999,XMINST,5) ; script
113 ;K ^XMBS(4.2999,XMINST,6) ; xmit audit history (don't delete)
114 S XMIENS=XMINST_","
115 S XMFDA(4.2999,XMIENS,42)=$$NOW^XLFDT ; finish time
116 D FILE^DIE("","XMFDA")
117 L -^XMBS(4.2999,XMINST)
118 Q
119ERRTRAP ; (Called from ^XMCTRAP)
120 I '$D(ZTSK)!$G(XMPOLL) D XMTFINIS(XMINST) Q
121 D REQUEUE^XMKPR(XMINST,XMSITE,.XMB)
122 Q
123XMTSTAT(XMINST,XMWHICH,XMTXT,XMINCR) ; Statistics recording for message transmission
124 ; We write to 4.2999 every 20 lines up to 100, and then every 100 lines
125 ; after that.
126 ; XMWHICH S=Send; R=Receive
127 ; XMTXT XMSG or XMRG (What is sent or received)
128 S XMC("C",XMWHICH)=$G(XMC("C",XMWHICH))+$L(XMTXT) ; chars xmit this session
129 S XMC("L")=$G(XMC("L"))+$G(XMINCR,1) ; lines xmit this session
130 Q:XMC("L")#$S(XMC("L")>100:100,1:20)
131 S ^XMBS(4.2999,XMINST,3)=$H_U_$G(XMZ)_U_XMC("L")_U_$G(XMLER)_U_$J($G(XMC("C","R"))+$G(XMC("C","S"))/($$TSTAMP^XMXUTIL1-XMC("START")),0,0)_U_$E(IO,1,9)_" "_XMPROT_U_$G(ZTSK)_U_$G(XMC("DIR"))
132 Q
133XMTHIST(XMINST,XMWHICH,XMLINES) ; Update history statistics for sending/receiving msgs
134 N XMMONTH,XMREC,XMOFF
135 S XMMONTH=$E(DT,1,5)
136 S XMREC=$G(^XMBS(4.2999,XMINST,100,XMMONTH,0))
137 I XMREC="" D
138 . S XMREC=XMMONTH_"00"
139 . D STATMON(XMINST,XMMONTH)
140 S XMC(XMWHICH)=$G(XMC(XMWHICH))+1
141 S XMOFF=(XMWHICH="R") ; 0 if "S"; 1 if "R"
142 S $P(XMREC,U,2+XMOFF)=$P(XMREC,U,2+XMOFF)+1 ; msgs sent/rcvd
143 S $P(XMREC,U,4)=$P(XMREC,U,4)+$G(XMC("C","S"))-$G(XMC("C","S","CHK")) ; chars sent
144 S $P(XMREC,U,5)=$P(XMREC,U,5)+$G(XMC("C","R"))-$G(XMC("C","R","CHK")) ; chars rcvd
145 S $P(XMREC,U,6+XMOFF)=$P(XMREC,U,6+XMOFF)+XMLINES ; lines sent/rcvd
146 S ^XMBS(4.2999,XMINST,100,XMMONTH,0)=XMREC
147 S XMC("C","S","CHK")=$G(XMC("C","S")) ; chars sent checkpoint
148 S XMC("C","R","CHK")=$G(XMC("C","R")) ; chars rcvd checkpoint
149 Q
150STATMON(XMINST,XMMONTH) ; Set up a record for a month for a domain
151 D:'$D(^XMBS(4.2999,XMINST,0)) STAT(XMINST)
152 N XMFDA,XMIEN
153 S XMFDA(4.29991,"+1,"_XMINST_",",.01)=XMMONTH_"00"
154 S XMIEN(1)=XMMONTH
155 D UPDATE^DIE("","XMFDA","XMIEN")
156 Q
157STAT(XMINST) ; Set up record for domain in 4.2999 MESSAGE STATISTICS file
158 Q:$D(^XMBS(4.2999,XMINST,0))
159 N XMFDA,XMIEN
160 S XMFDA(4.2999,"+1,",.01)=XMINST
161 S XMIEN(1)=XMINST
162 D UPDATE^DIE("","XMFDA","XMIEN") Q:'$D(DIERR)
163 ; Just in case the call fails, we must do it ourselves
164 S ^XMBS(4.2999,XMINST,0)=XMINST
165 S ^XMBS(4.2999,"B",XMINST,XMINST)=""
166 Q
Note: See TracBrowser for help on using the repository browser.