source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DG488M.m@ 1742

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

initial load of WorldVistAEHR

File size: 5.0 KB
Line 
1DG488M ;ALB/GN - MONITOR/MAIL CLEANUP PATIENT RELATION & INCOME FILES;12/11/02 ; 2/4/03 12:56pm
2 ;;5.3;REGISTRATION;**488**;5-1-2001
3 ;
4 Q
5 ;
6MONITOR ; Monitor job while running
7 N IOINORM,IOINHI,IOUON,IOUOFF,IOBON,IOBOFF,IORVON,IORVOFF,IOHOME
8 N IOELEOL,NAMSPC,DGT12,DG12,DG12X,DGT21,DG21,DG21X,DGT22,DG22,DG22X
9 N STAT,DGLINE,DGBLNK,NOWTIM,%H,DTOUT,I,DGLEN,DGQUIT,TITLE,TLEN,X,REC
10 N NAMSPC,NOWTIME,PCT,TESTING,TASKID,MODE,BTIME,DGFIL,DGIEN,STIME,RUN
11 S:'$D(U) U="^"
12 S NAMSPC=$$NAMSPC^DG488
13 S DGQUIT=0
14 D SCRNSET
15 S TESTING=+$G(^XTMP(NAMSPC,0,"TESTING"))
16 S TASKID=$G(^XTMP(NAMSPC,0,"TASKID"))
17 ;
18 F D Q:DGQUIT
19 . ;check lock status
20 . L +^XTMP(NAMSPC):3
21 . I '$T S RUN=1
22 . E S RUN=0
23 . L -^XTMP(NAMSPC)
24 . ;get last run info
25 . D GETLAST^DG488
26 . S:STAT="" STAT="NOT RUNNING"
27 . S NOWTIME=$$NOW^XLFDT
28 . I (RUN&(STAT'="RUNNING"))!('RUN&(STAT="RUNNING")) D
29 . . S STAT="ERRORED"
30 . D CLRSCR
31 . S $P(DGBLNK," ",81)=""
32 . S DGLINE=DGBLNK
33 . S TITLE=$P($G(^XTMP(NAMSPC,0),"^^DG488 JOB"),U,3)
34 . S TLEN=(80-$L(TITLE)\2)
35 . W $$FMTE^XLFDT($$NOW^XLFDT,"2P")
36 . S MODE=$S(TESTING:"TEST",1:"LIVE")
37 . W ?32,"** ",MODE," MODE **"
38 . W ?63,"Task ID: ",TASKID
39 . W !!
40 . ;title line
41 . W ?TLEN,IOINHI,IOUON,TITLE,IOUOFF,IOINORM,!
42 . ;begin next line
43 . S DGLINE=DGBLNK
44 . S DGLINE=$$FMTLINE(DGLINE,4,"Status")
45 . S DGLINE=$$FMTLINE(DGLINE,30,"Last ien")
46 . S DGLINE=$$FMTLINE(DGLINE,58,"Completed Time")
47 . W !!,IORVON,DGLINE,IORVOFF
48 . ;begin next line
49 . S DGLINE=DGBLNK
50 . S DGLINE=$$FMTLINE(DGLINE,4,STAT)
51 . S DGLINE=$$FMTLINE(DGLINE,26,DGFIL_"/"_DGIEN)
52 . S DGLINE=$$FMTLINE(DGLINE,58,$$FMTE^XLFDT(STIME,2))
53 . W !,DGLINE
54 . ;begin next line
55 . S DGLINE=DGBLNK
56 . S DGLINE=$$FMTLINE(DGLINE,5,"Tot 408.12 recs")
57 . S DGLINE=$$FMTLINE(DGLINE,30,"408.12 recs purged")
58 . S DGLINE=$$FMTLINE(DGLINE,55,"408.12 bad xrefs")
59 . W !!,IORVON,DGLINE,IORVOFF
60 . ;begin next line
61 . S DGLINE=DGBLNK
62 . S DGLINE=$$FMTLINE(DGLINE,7,$J($FN(DGT12,","),10))
63 . S DGLINE=$$FMTLINE(DGLINE,32,$J($FN(DG12,","),10))
64 . S DGLINE=$$FMTLINE(DGLINE,57,$J($FN(DG12X,","),10))
65 . W !,DGLINE
66 . ;begin next line
67 . S DGLINE=DGBLNK
68 . S DGLINE=$$FMTLINE(DGLINE,5,"Tot 408.21 recs")
69 . S DGLINE=$$FMTLINE(DGLINE,30,"408.21 recs purged")
70 . S DGLINE=$$FMTLINE(DGLINE,55,"408.21 bad xrefs")
71 . W !!,IORVON,DGLINE,IORVOFF
72 . ;begin next line
73 . S DGLINE=DGBLNK
74 . S DGLINE=$$FMTLINE(DGLINE,7,$J($FN(DGT21,","),10))
75 . S DGLINE=$$FMTLINE(DGLINE,32,$J($FN(DG21,","),10))
76 . S DGLINE=$$FMTLINE(DGLINE,57,$J($FN(DG21X,","),10))
77 . W !,DGLINE
78 . ;begin next line
79 . S DGLINE=DGBLNK
80 . S DGLINE=$$FMTLINE(DGLINE,5,"Tot 408.22 recs")
81 . S DGLINE=$$FMTLINE(DGLINE,30,"408.22 recs purged")
82 . S DGLINE=$$FMTLINE(DGLINE,55,"408.22 bad xrefs")
83 . W !!,IORVON,DGLINE,IORVOFF
84 . ;begin next line
85 . S DGLINE=DGBLNK
86 . S DGLINE=$$FMTLINE(DGLINE,7,$J($FN(DGT22,","),10))
87 . S DGLINE=$$FMTLINE(DGLINE,32,$J($FN(DG22,","),10))
88 . S DGLINE=$$FMTLINE(DGLINE,57,$J($FN(DG22X,","),10))
89 . W !,DGLINE
90 . ;begin next line
91 . S DGLINE=DGBLNK
92 . W !!!
93 . K DIR
94 . S DIR("T")=5
95 . W ?15,"screen refreshes automatically every "_DIR("T")_" seconds",!
96 . W !!,"Press "_IORVON_"<Enter>"_IORVOFF_" to Stop Monitor...",!
97 . S DIR(0)="EA"
98 . D ^DIR
99 . I '$D(DTOUT) S DGQUIT=1
100 . I STAT'="RUNNING" S DGQUIT=1
101 W @IOF
102 Q
103 ;
104FMTLINE(DGLINE,DGTB,DGTX) ; format a line
105 N DGEND
106 S DGLEN=$L(DGTX)
107 S DGEND=DGTB+DGLEN-1
108 S $E(DGLINE,DGTB,DGEND)=DGTX
109 Q DGLINE
110 ;
111SCRNSET ; setup screen variables
112 S:'$D(IOST(0)) IOST(0)="C-VT320"
113 S X="IOINORM;IOINHI;IOUON;IOUOFF;IOBON;IOBOFF;IORVON;IORVOFF;IOHOME"
114 S X=X_";IOELEOL" D ENDR^%ZISS
115 Q
116 ;
117CLRSCR ; clear screen and return to normal
118 W IOHOME,IORVOFF,IOBOFF,IOUOFF,IOINORM,@IOF
119 S $X=0,$Y=0
120 Q
121 ;
122MAIL ; mail stats
123 N HTEXT,TEXT,NAMSPC,LIN
124 S LIN=0
125 S NAMSPC=$$NAMSPC^DG488
126 K ^TMP(NAMSPC,$J)
127 ;get last run data
128 D GETLAST^DG488
129 ;build text for message
130 S HTEXT=ZTDESC_" "_STAT_" on "
131 S HTEXT=HTEXT_$$FMTE^XLFDT(STIME)
132 D BLDLINE(HTEXT)
133 D BLDLINE("Elapsed time: "_$$FMDIFF^XLFDT(STIME,BTIME,3))
134 D BLDLINE("")
135 I TESTING S TEXT="** TESTING **" D BLDLINE(TEXT)
136 D BLDLINE("")
137 S TEXT=" Total 408.12 Records Processed: "_$J($FN(DGT12,","),11)
138 D BLDLINE(TEXT)
139 S TEXT=" 408.12 bad records purged: "_$J($FN(DG12,","),11)
140 D BLDLINE(TEXT)
141 S TEXT=" 408.12 bad xrefs purged: "_$J($FN(DG12X,","),11)
142 D BLDLINE(TEXT)
143 D BLDLINE("")
144 S TEXT=" Total 408.21 Records Processed: "_$J($FN(DGT21,","),11)
145 D BLDLINE(TEXT)
146 S TEXT=" 408.21 bad records purged: "_$J($FN(DG21,","),11)
147 D BLDLINE(TEXT)
148 S TEXT=" 408.21 bad xrefs purged: "_$J($FN(DG21X,","),11)
149 D BLDLINE(TEXT)
150 D BLDLINE("")
151 S TEXT=" Total 408.22 Records Processed: "_$J($FN(DGT22,","),11)
152 D BLDLINE(TEXT)
153 S TEXT=" 408.22 bad records purged: "_$J($FN(DG22,","),11)
154 D BLDLINE(TEXT)
155 S TEXT=" 408.22 bad xrefs purged: "_$J($FN(DG22X,","),11)
156 D BLDLINE(TEXT)
157 ;send the message
158 D MAILIT(HTEXT)
159 K ^TMP(NAMSPC,$J)
160 Q
161 ;
162BLDLINE(TEXT) ;
163 S LIN=LIN+1
164 S ^TMP(NAMSPC,$J,"MSG",LIN)=TEXT
165 Q
166MAILIT(HTEXT) ; send the mail message
167 N XMY,XMDUZ,XMSUB,XMTEXT
168 S XMY(DUZ)="",XMDUZ=.5
169 S XMSUB=HTEXT_" Results"
170 S XMTEXT="^TMP(NAMSPC,$J,""MSG"","
171 D ^XMD
172 Q
173 ;
Note: See TracBrowser for help on using the repository browser.