source: FOIAVistA/trunk/r/HEALTH_LEVEL_SEVEN-HL/HLEVUTI3.m@ 767

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

initial load of FOIAVistA 6/30/08 version

File size: 4.1 KB
Line 
1HLEVUTI3 ;O-OIFO/LJA - Event Monitor UTILITIES ;02/04/2004 14:42
2 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
3 ;
4MOVETMP(FILE,IEN,GBLSV) ; Move ^UTILITY data into ^TMP and prep it...
5 N DATA,FLD,FLDLEN,FLDNM,GBL,MNO,NO,NUM,STR
6 ;
7 KILL ^TMP($J,"HLTMP")
8 ;
9 S GBL=$NA(^UTILITY("DIQ1",$J))
10 ;
11 D ADDLN(GBLSV,$$CJ^XLFSTR(" "_FILE_"#: "_IEN_" ",74,"="))
12 ;
13 S FLD=0
14 F S FLD=$O(@GBL@(FILE,IEN,FLD)) Q:FLD'>0 D
15 . S FLDNM="["_$P($G(^DD(+FILE,+FLD,0)),U)
16 . S DATA=$G(@GBL@(FILE,IEN,+FLD,"E"))
17 . I DATA]"" D QUIT ;->
18 . . S NO=$O(^TMP($J,"HLTMP",":"),-1)+1
19 . . S ^TMP($J,"HLTMP",+NO)=FLDNM_U_FLD_U_DATA_"]"
20 . S MNO=0,FLD(1)=FLD
21 . F S MNO=$O(@GBL@(FILE,IEN,FLD,"E",MNO)) Q:MNO'>0 D
22 . . S DATA=$G(@GBL@(FILE,IEN,FLD,"E",+MNO))
23 . . S NO=$O(^TMP($J,"HLTMP",":"),-1)+1
24 . . S ^TMP($J,"HLTMP",+NO)=FLDNM_U_FLD(1)_U_DATA_"]"
25 ;
26 S NO=0,STR=""
27 F S NO=$O(^TMP($J,"HLTMP",NO)) Q:NO'>0 D
28 . S DATA=^TMP($J,"HLTMP",NO) QUIT:DATA']"" ;->
29 . S FLDNM=$P(DATA,U),FLD=$P(DATA,U,2),DATA=$P(DATA,U,3,999)
30 . I FILE=772,FLD=200 S FLDNM="MSG"
31 . S FLDNM=$S(FLDNM]"":FLDNM_": ",1:""),FLDLEN=$L(FLDNM)
32 . S DATA=$$LOW^XLFSTR(FLDNM)_DATA
33 . I FLD']"" D QUIT ;-> standalone line...
34 . . I STR]"" D ADDLN(GBLSV,STR)
35 . . D ADDLN(GBLSV," "_DATA)
36 . I ($L(STR)+$L(DATA)+3)>74 D
37 . . I STR]"" D ADDLN(GBLSV,STR)
38 . . S STR=""
39 . S STR=STR_$$PAD(STR,$L(DATA))_DATA QUIT:$L(STR)<74 ;->
40 . F D QUIT:STR']""
41 . . D ADDLN(GBLSV,$E(STR,1,74))
42 . . S STR=$E(STR,75,999) QUIT:STR']"" ;->
43 . . S STR=" "_STR
44 I STR]"" D ADDLN(GBLSV,STR)
45 ;
46 KILL ^TMP($J,"HLTMP")
47 ;
48 Q
49 ;
50PAD(STR,LEN) ; Add spaces to right justify...
51 QUIT:STR']"" "" ;->
52 I ($L(STR)+LEN)<40 QUIT " " ;->
53 Q $$REPEAT^XLFSTR(" ",74-$L(STR)-LEN)
54 ;
55ADDLN(GBLSV,DATA) ; Add one line of text...
56 N NUM
57 S NUM=$O(^TMP($J,GBLSV,":"),-1)+1
58 S ^TMP($J,GBLSV,+NUM)=DATA
59 Q
60 ;
61LASTIEN ; Display last IEN of files 772 & 773 every 15 seconds...
62 N B,CT,DIFF,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IEN772,IEN773
63 N LAST772,LAST773,STOP,TIMEOUT,X,Y
64 ;
65 W @IOF,$$CJ^XLFSTR("File 772 & 773 IEN Display",IOM)
66 W !,$$REPEAT^XLFSTR("=",IOM)
67 ;
68 W !!,"This API displays the last internal entry number (IEN) in the following files:"
69 W !!," * HL Message Text file (#772)."
70 W !," * HL Message Administration file (#773)."
71 W !!,"The last IEN in these files are recollected and redisplayed every 15 seconds."
72 W !,"After every display of these IENs, you may take the following actions:"
73 W !!," * Do nothing, & the information will be redisplayed in 15 seconds."
74 W !," (You may change the refresh seconds by entering a number of seconds"
75 W !," and pressing RETURN.)"
76 W !!," * Hit return to force information redisplay."
77 W !!," * Enter an uparrow ('^') and press RETURN to exit."
78 ;
79 F QUIT:($Y+3)>IOSL W !
80 QUIT:$$BTE^HLCSMON("Press RETURN to start, or '^' to exit... ") ;->
81 ;
82 W @IOF
83 S X=$$SITE^VASITE W $$CJ^XLFSTR(" "_$P(X,U,2)_" ["_$P(X,U,3)_"] ",IOM,"=")
84 D HDRIEN
85 ;
86 S CT=0,TIMEOUT=15,B="|"
87 S (IEN772,IEN773,LAST772,LAST773)=""
88 ;
89 F D QUIT:STOP
90 . S CT=CT+1
91 . S IEN772=$O(^HL(772,":"),-1),IEN773=$O(^HLMA(":"),-1)
92 . I '(CT#22) W !! D HDRIEN
93 . W !,$$SDT($$NOW^XLFDT),?19,B
94 . W ?21,IEN772,?36,$$DIFFIEN(IEN772,LAST772),?45,B
95 . W ?47,IEN773,?61,$$DIFFIEN(IEN773,LAST773),?73,B
96 . S LAST772=IEN772,LAST773=IEN773
97 . S STOP=1
98 . R " ",X:TIMEOUT
99 . QUIT:X[U ;->
100 . S STOP=0
101 . QUIT:'$T ;-> Timed out...
102 . I X=+X,X>0 S TIMEOUT=X D QUIT ;->
103 . . W """"
104 . ; User pressed RETURN...
105 . W "<ret>"
106 ;
107 Q
108 ;
109DIFFIEN(LAST,BEFORE) ; Return number new entries right justified in 3 col's
110 N DIFF
111 QUIT:LAST'>0!(BEFORE'>0) "" ;->
112 S DIFF=LAST-BEFORE QUIT:DIFF'>0 "" ;->
113 QUIT $J(DIFF,3)
114 ;
115HDRIEN ;
116 N B
117 S B="|"
118 W:$X>0 !
119 W "Time",?19,B,?21,"LAST-772-IEN",?36,"#772",?45,B
120 W ?47,"LAST-773-IEN",?61,"#773",?73,B
121 W !,$$REPEAT^XLFSTR("=",IOM)
122 Q
123 ;
124SDT(FMTIME) ; Return DD/MM/YY@HH:MM:SS
125 N DATE,TIME
126 QUIT:$G(FMTIME)'?7N.E "" ;->
127 S TIME=$S(FMTIME?7N1"."1.N:"@"_$E($P($$FMTE^XLFDT(FMTIME),"@",2)_":00:00",1,8),1:"")
128 S DATE=$E(FMTIME,4,5)_"/"_$E(FMTIME,6,7)_"/"_$E(FMTIME,2,3)
129 Q DATE_TIME
130 ;
131EOR ;HLEVUTI3 - Event Monitor UTILITIES ;5/16/03 14:42
Note: See TracBrowser for help on using the repository browser.