1 | KMPDSSD ;OAK/RAK - CM Tools Status ;2/14/05 11:42
|
---|
2 | ;;2.0;CAPACITY MANAGEMENT TOOLS;**3**;Mar 22, 2002
|
---|
3 | ;
|
---|
4 | FORMAT(KMPDLN) ;-format text for display
|
---|
5 | ;-----------------------------------------------------------------------------
|
---|
6 | ; KMPDLN.... return number of lines - called by reference
|
---|
7 | ;-----------------------------------------------------------------------------
|
---|
8 | ;
|
---|
9 | Q:$G(KMPDNMSP)=""
|
---|
10 | ;
|
---|
11 | N LN,VERSION,X S LN=0 K TMP
|
---|
12 | ;
|
---|
13 | ; if no kmpdutl routine
|
---|
14 | S X="KMPDUTL" X ^%ZOSF("TEST") I '$T D Q
|
---|
15 | .S LN=LN+1
|
---|
16 | .D SET^VALM10(LN,"The CM Tools Package is not installed!")
|
---|
17 | ;
|
---|
18 | ; version data
|
---|
19 | S VERSION=$$VERSION^KMPDUTL
|
---|
20 | ;
|
---|
21 | ; option data
|
---|
22 | D OPT("KMPD BACKGROUND DRIVER")
|
---|
23 | ;
|
---|
24 | ; bacground data
|
---|
25 | D BKGRND
|
---|
26 | ;
|
---|
27 | ; file data
|
---|
28 | D FILES
|
---|
29 | ;
|
---|
30 | ; routine version check
|
---|
31 | D ROUCHK^KMPDSSD1("D")
|
---|
32 | ;
|
---|
33 | ; node/cpu data
|
---|
34 | D CPU^KMPDSSD1
|
---|
35 | ;
|
---|
36 | ; mailgroup members
|
---|
37 | D MGRP^KMPDSSD1
|
---|
38 | ;
|
---|
39 | ; legend
|
---|
40 | D LEGEND
|
---|
41 | ;
|
---|
42 | S KMPDLN=LN
|
---|
43 | ;
|
---|
44 | Q
|
---|
45 | ;
|
---|
46 | BKGRND ; hl7 background info
|
---|
47 | ;
|
---|
48 | N DATA,DELTA,ENDT,I,STAT,STDT,Z
|
---|
49 | ;
|
---|
50 | D PARAMS^KMPDUT("DATA") Q:'$D(DATA)
|
---|
51 | S DATA(3)=$G(DATA(3)),DATA(4)=$G(DATA(4))
|
---|
52 | S STDT=$P(DATA(3),U,5),ENDT=$P(DATA(3),U,6),DELTA=$P(DATA(3),U,7)
|
---|
53 | S:$E(DELTA)=" " $E(DELTA)="0"
|
---|
54 | ; if hl7
|
---|
55 | I KMPDNMSP="H" D
|
---|
56 | .S LN=LN+1
|
---|
57 | .D SET^VALM10(LN,"")
|
---|
58 | .S LN=LN+1
|
---|
59 | .D SET^VALM10(LN," Hl7 Dly Bckgrnd Last Start.. "_$$FMTE^XLFDT(STDT))
|
---|
60 | .S LN=LN+1
|
---|
61 | .D SET^VALM10(LN," HL7 Dly Bckgrnd Last Stop... "_$$FMTE^XLFDT(ENDT))
|
---|
62 | .S LN=LN+1
|
---|
63 | .D SET^VALM10(LN," HL7 Dly Bkgrnd Total Time... "_DELTA)
|
---|
64 | .S STDT=$P(DATA(3),U,8),ENDT=$P(DATA(3),U,9),DELTA=$P(DATA(3),U,10)
|
---|
65 | .S:$E(DELTA)=" " $E(DELTA)="0"
|
---|
66 | .S LN=LN+1
|
---|
67 | .D SET^VALM10(LN,"")
|
---|
68 | .S LN=LN+1
|
---|
69 | .D SET^VALM10(LN," HL7 Wkly Backgrnd Last Start "_$$FMTE^XLFDT(STDT))
|
---|
70 | .S LN=LN+1
|
---|
71 | .D SET^VALM10(LN," HL7 Wkly Bckgrnd Last Stop.. "_$$FMTE^XLFDT(ENDT))
|
---|
72 | .S LN=LN+1
|
---|
73 | .D SET^VALM10(LN," HL7 Wkly Bckgrnd Total Time. "_DELTA)
|
---|
74 | .S LN=LN+1
|
---|
75 | .D SET^VALM10(LN," HL7 Purge Data After........ "_$P(DATA(3),U,11)_" weeks")
|
---|
76 | .D TRANSTO^KMPDUTL7(1,3,.Z)
|
---|
77 | .I '$D(Z) S LN=LN+1 D SET^VALM10(LN," HL7 Transmit Data to........ <>")
|
---|
78 | .E D
|
---|
79 | ..S I=$O(Z("")) I I'="" S LN=LN+1 D SET^VALM10(LN," HL7 Transmit Data to........ "_I)
|
---|
80 | ..F S I=$O(Z(I)) Q:I="" S LN=LN+1 D SET^VALM10(LN,$J(" ",32)_I)
|
---|
81 | .S LN=LN+1
|
---|
82 | .D SET^VALM10(LN,"")
|
---|
83 | ;
|
---|
84 | ; timing background info - if available
|
---|
85 | I KMPDNMSP="T" D
|
---|
86 | .S LN=LN+1
|
---|
87 | .D SET^VALM10(LN,"")
|
---|
88 | .I '$D(DATA(4)) S LN=LN+1 D SET^VALM10(LN," There is no Timing data to report") Q
|
---|
89 | .S STAT=$G(^KMPTMP("KMPD-CPRS"))
|
---|
90 | .S LN=LN+1
|
---|
91 | .D SET^VALM10(LN," TMG Collection Status....... "_$S(STAT:"Running",1:"STOPPED!"))
|
---|
92 | .S STDT=$P(DATA(4),U,5),ENDT=$P(DATA(4),U,6),DELTA=$P(DATA(4),U,7)
|
---|
93 | .S:$E(DELTA)=" " $E(DELTA)="0"
|
---|
94 | .S LN=LN+1
|
---|
95 | .D SET^VALM10(LN," TMG Dly Bckgrnd Last Start.. "_$$FMTE^XLFDT(STDT))
|
---|
96 | .S LN=LN+1
|
---|
97 | .D SET^VALM10(LN," TMG Dly Bckgrnd Last Stop... "_$$FMTE^XLFDT(ENDT))
|
---|
98 | .S LN=LN+1
|
---|
99 | .D SET^VALM10(LN," TMG Dly Bkgrnd Total Time... "_DELTA)
|
---|
100 | .S STDT=$P(DATA(4),U,8),ENDT=$P(DATA(4),U,9),DELTA=$P(DATA(4),U,10)
|
---|
101 | .S:$E(DELTA)=" " $E(DELTA)="0"
|
---|
102 | .S LN=LN+1
|
---|
103 | .D SET^VALM10(LN," TMG Purge Data After........ "_$P(DATA(4),U,11)_" weeks")
|
---|
104 | .D TRANSTO^KMPDUTL7(1,4,.Z)
|
---|
105 | .I '$D(Z) S LN=LN+1 D SET^VALM10(LN," TMG Transmit Data to........ <>")
|
---|
106 | .E D
|
---|
107 | ..S I=$O(Z("")) I I'="" S LN=LN+1 D SET^VALM10(LN," TMG Transmit Data to........ "_I)
|
---|
108 | ..F S I=$O(Z(I)) Q:I="" S LN=LN+1 D SET^VALM10(LN,$J(" ",32)_I)
|
---|
109 | .S LN=LN+1
|
---|
110 | .D SET^VALM10(LN,"")
|
---|
111 | ;
|
---|
112 | Q
|
---|
113 | ;
|
---|
114 | FILES ;-- file data
|
---|
115 | ;
|
---|
116 | N TEXT,X
|
---|
117 | ;
|
---|
118 | S LN=LN+1
|
---|
119 | D SET^VALM10(LN,$J(" ",35)_" # of Oldest Recent")
|
---|
120 | S LN=LN+1
|
---|
121 | D SET^VALM10(LN," File"_$J(" ",28)_"Entries Date Date")
|
---|
122 | S LN=LN+1
|
---|
123 | D SET^VALM10(LN," ------------------------- ------- ------- -------")
|
---|
124 | ;
|
---|
125 | ; if hl7
|
---|
126 | I KMPDNMSP="H" D
|
---|
127 | .; file name
|
---|
128 | .S TEXT=" 8973.1 - "_$P($G(^DIC(8973.1,0)),U)
|
---|
129 | .; number of entries
|
---|
130 | .S TEXT=TEXT_$J(" ",35-$L(TEXT))_$J($FN($P($G(^KMPD(8973.1,0)),U,4),",",0),7)
|
---|
131 | .; oldest date
|
---|
132 | .S X=$$FMTE^XLFDT(+$O(^KMPD(8973.1,"B",0)),2)
|
---|
133 | .S X=$S(X=0:"---",1:X)
|
---|
134 | .S TEXT=TEXT_$J(" ",45-$L(TEXT))_X
|
---|
135 | .; current date
|
---|
136 | .S X=$$FMTE^XLFDT(+$O(^KMPD(8973.1,"B","A"),-1),2)
|
---|
137 | .S X=$S(X=0:"---",1:X)
|
---|
138 | .S TEXT=TEXT_$J(" ",55-$L(TEXT))_X
|
---|
139 | .S LN=LN+1
|
---|
140 | .D SET^VALM10(LN,TEXT)
|
---|
141 | ;
|
---|
142 | ; if timing data
|
---|
143 | I KMPDNMSP="T" D
|
---|
144 | .; file name
|
---|
145 | .S TEXT=" 8973.2 - "_$P($G(^DIC(8973.2,0)),U)
|
---|
146 | .; number of entries
|
---|
147 | .S TEXT=TEXT_$J(" ",35-$L(TEXT))_$J($FN($P($G(^KMPD(8973.2,0)),U,4),",",0),7)
|
---|
148 | .; oldest date
|
---|
149 | .S X=$$FMTE^XLFDT($P(+$O(^KMPD(8973.2,"C",0)),"."),2)
|
---|
150 | .S X=$S(X=0:"---",1:X)
|
---|
151 | .S TEXT=TEXT_$J(" ",45-$L(TEXT))_X
|
---|
152 | .; most recent date
|
---|
153 | .S X=$$FMTE^XLFDT($P(+$O(^KMPD(8973.2,"ASTDTTM","A"),-1),"."),2)
|
---|
154 | .S X=$S(X=0:"---",1:X)
|
---|
155 | .S TEXT=TEXT_$J(" ",55-$L(TEXT))_X
|
---|
156 | .S LN=LN+1
|
---|
157 | .D SET^VALM10(LN,TEXT)
|
---|
158 | ;
|
---|
159 | Q
|
---|
160 | ;
|
---|
161 | LEGEND ;-- display legend
|
---|
162 | ;
|
---|
163 | S LN=LN+1
|
---|
164 | D SET^VALM10(LN,"")
|
---|
165 | S LN=LN+1
|
---|
166 | D SET^VALM10(LN,"")
|
---|
167 | I KMPDNMSP="H" D
|
---|
168 | .S LN=LN+1
|
---|
169 | .D SET^VALM10(LN," HL7 = Health Level Seven")
|
---|
170 | I KMPDNMSP="T" D
|
---|
171 | .S LN=LN+1
|
---|
172 | .D SET^VALM10(LN," TMG = Timing Data")
|
---|
173 | ;
|
---|
174 | Q
|
---|
175 | ;
|
---|
176 | OPT(KMPDOPT) ;-- option data
|
---|
177 | ;-----------------------------------------------------------------------------
|
---|
178 | ; KMPDOPT... Option name - free text
|
---|
179 | ;-----------------------------------------------------------------------------
|
---|
180 | ;
|
---|
181 | Q:$G(KMPDOPT)=""
|
---|
182 | ;
|
---|
183 | N DIR,DOW,FREQ,KMPDX,KMPDX1,OPTEXT,STATUS,TEXT,X,Y
|
---|
184 | ;
|
---|
185 | S STATUS=$$TSKSTAT^KMPDUTL1(KMPDOPT)
|
---|
186 | ;
|
---|
187 | ; option not in system
|
---|
188 | Q:(+STATUS)=3
|
---|
189 | ;
|
---|
190 | S OPTEXT=""
|
---|
191 | S:KMPDOPT="KMPD BACKGROUND DRIVER" OPTEXT="CM Tools Background Driver"
|
---|
192 | S:KMPDOPT="KMPR BACKGROUND DRIVER" OPTEXT="RUM Background Driver"
|
---|
193 | S:KMPDOPT="KMPS SAGG REPORT" OPTEXT="SAGG Master Background Task"
|
---|
194 | ;
|
---|
195 | ; if background option is missing
|
---|
196 | I (+STATUS)=3 D Q
|
---|
197 | .S LN=LN+1
|
---|
198 | .D SET^VALM10(LN," The "_OPTEXT_" option [KMPD BACKGROUND DRIVER] is missing!")
|
---|
199 | ;
|
---|
200 | ; background option is present
|
---|
201 | ;
|
---|
202 | ; if cm tools and not scheduled or no task id
|
---|
203 | I KMPDOPT="KMPD BACKGROUND DRIVER"&(+(STATUS)=3) D Q:'Y
|
---|
204 | .K DIR S DIR(0)="YO",DIR("B")="YES"
|
---|
205 | .S DIR("A")="Do you want to queue this option to run each night at 1:30am"
|
---|
206 | .W ! D ^DIR I 'Y D Q
|
---|
207 | ..S LN=LN+1
|
---|
208 | ..D SET^VALM10(LN," The "_OPTEXT_" ["_KMPDOPT_"] is not scheduled")
|
---|
209 | ..S LN=LN+1
|
---|
210 | ..D SET^VALM10(LN," to run!"),SET^VALM10(LN,"")
|
---|
211 | .D QUEBKG^KMPDUTL("KMPD BACKGROUND DRIVER","T+1@0130","1D",0)
|
---|
212 | ;
|
---|
213 | ; if not scheduled or no task id
|
---|
214 | I KMPDOPT="KMPR BACKGROUND DRIVER"&(+(STATUS)=3) D Q:'Y
|
---|
215 | .K DIR S DIR(0)="YO",DIR("B")="YES"
|
---|
216 | .S DIR("A")="Do you want to queue this option to run each night at 1am"
|
---|
217 | .W ! D ^DIR I 'Y D Q
|
---|
218 | .. S LN=LN+1
|
---|
219 | ..D SET^VALM10(LN," The "_OPTEXT_" ["_KMPDOPT_"] is not scheduled")
|
---|
220 | ..S LN=LN+1
|
---|
221 | ..D SET^VALM10(LN," to run!"),SET^VALM10(LN,"")
|
---|
222 | .D QUEBKG^KMPRUTL1
|
---|
223 | ;
|
---|
224 | ; check status again in case it has been requeued
|
---|
225 | S STATUS=$$TSKSTAT^KMPDUTL1(KMPDOPT)
|
---|
226 | ;
|
---|
227 | ; not scheduled
|
---|
228 | I (+STATUS)=1 S LN=LN+1 D SET^VALM10(LN," The "_OPTEXT_" [KMPD BACKGROUND DRIVER] is not scheduled") Q
|
---|
229 | ;
|
---|
230 | S TEXT=" "_OPTEXT
|
---|
231 | S TEXT=TEXT_$$REPEAT^XLFSTR(".",31-$L(TEXT))
|
---|
232 | S TEXT=TEXT_" "_KMPDOPT
|
---|
233 | S LN=LN+1
|
---|
234 | D SET^VALM10(LN,TEXT)
|
---|
235 | S LN=LN+1
|
---|
236 | D SET^VALM10(LN," QUEUED TO RUN AT............ "_$P(STATUS,U,3))
|
---|
237 | S LN=LN+1
|
---|
238 | D SET^VALM10(LN," RESCHEDULING FREQUENCY...... "_$P(STATUS,U,5))
|
---|
239 | ;
|
---|
240 | ; check to see if SAGG is not running on the weekend (Fri-Sun)
|
---|
241 | S DOW=$P(STATUS,U,4),FREQ=$P(STATUS,U,6)
|
---|
242 | I KMPDOPT="KMPS SAGG REPORT" I (DOW<0)!((DOW>0)&(DOW<5))!(FREQ<0)!(FREQ'="28D") D
|
---|
243 | .S LN=LN+1
|
---|
244 | .D SET^VALM10(LN," ***It is STRONGLY recommended that this job be")
|
---|
245 | .S LN=LN+1
|
---|
246 | .D SET^VALM10(LN," rescheduled to run over the weekend every 28 days.***")
|
---|
247 | ;
|
---|
248 | S LN=LN+1
|
---|
249 | D SET^VALM10(LN," TASK ID..................... "_$P(STATUS,U,7))
|
---|
250 | ; user info.
|
---|
251 | S TEXT=" QUEUED BY................... "_$P(STATUS,U,8)
|
---|
252 | ; user
|
---|
253 | S TEXT=TEXT_" ("_$S($P(STATUS,U,9)["NOT ACTIVE":"Not Active - ",1:"Active")_")"
|
---|
254 | S LN=LN+1
|
---|
255 | D SET^VALM10(LN,TEXT)
|
---|
256 | ; if user is not active
|
---|
257 | I $P(STATUS,U,9)="NOT ACTIVE" D
|
---|
258 | .S LN=LN+1
|
---|
259 | .D SET^VALM10(LN," ***The user that originally queued this task is no ")
|
---|
260 | .S LN=LN+1
|
---|
261 | .D SET^VALM10(LN," longer active. Therefore the 'SAGG Master Background")
|
---|
262 | .S LN=LN+1
|
---|
263 | .D SET^VALM10(LN," Task' [KMPS SAGG REPORT] must be scheduled again by")
|
---|
264 | .S LN=LN=1
|
---|
265 | .D SET^VALM10(LN," an active user.***")
|
---|
266 | ;
|
---|
267 | Q
|
---|