[613] | 1 | HLEVREP2 ;O-OIFO/LJA - Event Monitor REPORTS ;02/04/2004 14:42
|
---|
| 2 | ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
|
---|
| 3 | ;
|
---|
| 4 | CTRL ; Called by 'Display monitor details [HLEV MONITOR DETAILS]'
|
---|
| 5 | N MONM
|
---|
| 6 | ;
|
---|
| 7 | KILL ^TMP($J)
|
---|
| 8 | ;
|
---|
| 9 | D HD
|
---|
| 10 | D EX
|
---|
| 11 | W !
|
---|
| 12 | QUIT:$$BTE^HLCSMON("Press RETURN to collect data, or enter '^' to exit... ") ;->
|
---|
| 13 | D MONVALL
|
---|
| 14 | ;
|
---|
| 15 | F D QUIT:MONM']""
|
---|
| 16 | . D MONLIST
|
---|
| 17 | . W !
|
---|
| 18 | . S MONM=$$ASKMON QUIT:MONM']"" ;->
|
---|
| 19 | . S WAY=$$ORDER I WAY'?1N S MONM="" QUIT ;->
|
---|
| 20 | . I WAY=1 D SHOWR(MONM)
|
---|
| 21 | . I WAY=2 D SHOWF(MONM)
|
---|
| 22 | . D HD
|
---|
| 23 | ;
|
---|
| 24 | KILL ^TMP($J)
|
---|
| 25 | ;
|
---|
| 26 | Q
|
---|
| 27 | ;
|
---|
| 28 | SHOWF(MONM) ; Show monitors from oldest to newest
|
---|
| 29 | N ABRT,HLEVIENJ,PMT
|
---|
| 30 | W !
|
---|
| 31 | S ABRT=0,HLEVIENJ=0
|
---|
| 32 | F S HLEVIENJ=$O(^TMP($J,"HLMONL",MONM,HLEVIENJ)) Q:'HLEVIENJ!(ABRT) D
|
---|
| 33 | . S X=$$NEXT,ABRT=$P(X,U,2),PRINT=+X QUIT:ABRT ;->
|
---|
| 34 | . I PRINT D SHOW(HLEVIENJ) W !
|
---|
| 35 | Q
|
---|
| 36 | ;
|
---|
| 37 | SHOWR(MONM) ; Show monitors from newest to oldest
|
---|
| 38 | N ABRT,HLEVIENJ,PRINT,X
|
---|
| 39 | W !
|
---|
| 40 | S ABRT=0,HLEVIENJ=":"
|
---|
| 41 | F S HLEVIENJ=$O(^TMP($J,"HLMONL",MONM,HLEVIENJ),-1) Q:'HLEVIENJ!(ABRT) D
|
---|
| 42 | . S X=$$NEXT,ABRT=$P(X,U,2),PRINT=+X QUIT:ABRT ;->
|
---|
| 43 | . I PRINT D SHOW(HLEVIENJ) W !
|
---|
| 44 | Q
|
---|
| 45 | ;
|
---|
| 46 | NEXT() ; Show next entry?
|
---|
| 47 | N ANS
|
---|
| 48 | S ANS=$$YN^HLEVUTIL("Display monitor ""run"" started at "_$P(^TMP($J,"HLMON",+HLEVIENJ,"START"),U,3),"No")
|
---|
| 49 | I ANS=1 QUIT "1^0" ;-> Display^Abort
|
---|
| 50 | I ANS="" QUIT "0^0" ;->
|
---|
| 51 | Q "0^1"
|
---|
| 52 | ;
|
---|
| 53 | SHOW(HLEVIENJ) ; Ask if want to view...
|
---|
| 54 | N GBL,LINES,MONM
|
---|
| 55 | ;
|
---|
| 56 | S GBL=$NA(^TMP($J,"HLMON",HLEVIENJ))
|
---|
| 57 | ;
|
---|
| 58 | ;
|
---|
| 59 | S LINES=$O(@GBL@("VIEW",":"),-1)
|
---|
| 60 | S MONM=$P($G(@GBL@("MONM")),U,3) QUIT:MONM']"" ;->
|
---|
| 61 | S MONM=MONM_"[#"_HLEVIENJ_"]"
|
---|
| 62 | ;
|
---|
| 63 | I LINES<22 D QUIT ;->
|
---|
| 64 | . W @IOF,$$CJ^XLFSTR(MONM,IOM),!,$$REPEAT^XLFSTR("=",IOM)
|
---|
| 65 | . S NO=0
|
---|
| 66 | . F S NO=$O(^TMP($J,"HLMON",+HLEVIENJ,"VIEW",NO)) Q:NO'>0 D
|
---|
| 67 | . . W !,^TMP($J,"HLMON",+HLEVIENJ,"VIEW",NO)
|
---|
| 68 | ;
|
---|
| 69 | D BROWSE^DDBR($NA(^TMP($J,"HLMON",+HLEVIENJ,"VIEW")),"N",MONM)
|
---|
| 70 | ;
|
---|
| 71 | Q
|
---|
| 72 | ;
|
---|
| 73 | ORDER() ; $ORDER direction...
|
---|
| 74 | N DIR,DIRUT,DTOUT,DUOUT
|
---|
| 75 | S DIR(0)="S^1:Show entries from newest to oldest;2:Show entries from oldest to newest;3:Exit"
|
---|
| 76 | S DIR("A")="Select display direction"
|
---|
| 77 | S DIR("B")=1
|
---|
| 78 | D ^DIR
|
---|
| 79 | Q $S(+Y=1!(+Y=2):+Y,1:"")
|
---|
| 80 | ;
|
---|
| 81 | ASKMON() ; Ask user to select a monitor...
|
---|
| 82 | N DIC,X,Y
|
---|
| 83 | S DIC=776.1,DIC(0)="AEMQ",DIC("A")="Select MONITOR: "
|
---|
| 84 | S DIC("S")="S HLEV=$P($G(^HLEV(776.1,+Y,0)),U) I HLEV]"""",$D(^TMP($J,""HLMONL"",HLEV))"
|
---|
| 85 | D ^DIC
|
---|
| 86 | Q $S(+Y>0:$P(Y,U,2),1:"")
|
---|
| 87 | ;
|
---|
| 88 | HD W @IOF,$$CJ^XLFSTR("Display Monitor Details",IOM)
|
---|
| 89 | W !,$$REPEAT^XLFSTR("=",IOM)
|
---|
| 90 | QUIT
|
---|
| 91 | ;
|
---|
| 92 | EX N I,T F I=1:1 S T=$T(EX+I) QUIT:T'[";;" W !,$P(T,";;",2,99)
|
---|
| 93 | ;;This option displays a detailed view of monitor run-time data. You can loop
|
---|
| 94 | ;;through all occurrences of a monitor from oldest to most recent, or from most
|
---|
| 95 | ;;recent to oldest.
|
---|
| 96 | QUIT
|
---|
| 97 | ;
|
---|
| 98 | MONLIST ; Create and print list of monitors...
|
---|
| 99 | N DATA,HLEVIENJ
|
---|
| 100 | ;
|
---|
| 101 | I '$D(^TMP($J,"HLMONL")) D QUIT:'$D(^TMP($J,"HLMONL")) ;->
|
---|
| 102 | . S HLEVIENJ=0
|
---|
| 103 | . F S HLEVIENJ=$O(^TMP($J,"HLMON",HLEVIENJ)) Q:'HLEVIENJ D
|
---|
| 104 | . . S MONM=$P($G(^TMP($J,"HLMON",+HLEVIENJ,"MONM")),U,3) QUIT:MONM']"" ;->
|
---|
| 105 | . . S ^TMP($J,"HLMONL",MONM)=$G(^TMP($J,"HLMONL",MONM))+1
|
---|
| 106 | . . S ^TMP($J,"HLMONL",MONM,+HLEVIENJ)=""
|
---|
| 107 | ;
|
---|
| 108 | W !!,"""Runs"" for the following monitors have been found..."
|
---|
| 109 | W !!
|
---|
| 110 | ;
|
---|
| 111 | S MONM=""
|
---|
| 112 | F S MONM=$O(^TMP($J,"HLMONL",MONM)) Q:MONM']"" D
|
---|
| 113 | . S CT=^TMP($J,"HLMONL",MONM),MONM(1)=MONM_"[#"_CT_"]"
|
---|
| 114 | . W:$X>40 ! W:$X>1 ?40
|
---|
| 115 | . W MONM(1)
|
---|
| 116 | ;
|
---|
| 117 | Q
|
---|
| 118 | ;
|
---|
| 119 | MONVALL ; Collect and build screens for all HLEVIENJs...
|
---|
| 120 | N CT,HLEVIENJ
|
---|
| 121 | ;
|
---|
| 122 | KILL ^TMP($J,"HLMON")
|
---|
| 123 | ;
|
---|
| 124 | ; Load here...
|
---|
| 125 | S HLEVIENJ=0,CT=0
|
---|
| 126 | F S HLEVIENJ=$O(^HLEV(776,HLEVIENJ)) Q:HLEVIENJ'>0 D
|
---|
| 127 | . D MONALL(+HLEVIENJ)
|
---|
| 128 | . S CT=CT+1 W:'(CT#50) "."
|
---|
| 129 | ;
|
---|
| 130 | Q
|
---|
| 131 | ;
|
---|
| 132 | MONALL(HLEVIENJ) ; Build screen for one entry...
|
---|
| 133 | N GBL
|
---|
| 134 | ;
|
---|
| 135 | S GBL=$NA(^TMP($J,"HLMON",+HLEVIENJ))
|
---|
| 136 | KILL @GBL
|
---|
| 137 | ;
|
---|
| 138 | D MONLOAD^HLEVREP3(+HLEVIENJ) QUIT:'$D(^TMP($J,"HLMON",+HLEVIENJ)) ;->
|
---|
| 139 | D MONHHDR(+HLEVIENJ) ; Build HEADER portion of screen
|
---|
| 140 | D MONVVAR(+HLEVIENJ) ; Build VARIABLE portion of screen
|
---|
| 141 | D MONRRD(+HLEVIENJ) ; Build RUN DIARY portion of screen
|
---|
| 142 | D MONMMT(+HLEVIENJ) ; Build MSG TEXT portion of screen
|
---|
| 143 | ;
|
---|
| 144 | Q
|
---|
| 145 | ;
|
---|
| 146 | ;
|
---|
| 147 | MONHHDR(HLEVIENJ) ; Build header...
|
---|
| 148 | ; ^TMP($J,"HLMON",+HLEVIENJ) -- req
|
---|
| 149 | N TXT
|
---|
| 150 | ;
|
---|
| 151 | D ADDLINE("Start Timestamp Finish Status Appl Mail")
|
---|
| 152 | D ADDLINE($$REPEAT^XLFSTR("=",IOM))
|
---|
| 153 | ;
|
---|
| 154 | S TXT=""
|
---|
| 155 | D ADD("START",11),ADD("TIME",11),ADD("DONE",11),ADD("STATR",7)
|
---|
| 156 | D ADD("MAIL",14)
|
---|
| 157 | D ADDLINE(TXT)
|
---|
| 158 | ;
|
---|
| 159 | Q
|
---|
| 160 | ;
|
---|
| 161 | MONVVAR(HLEVIENJ) ; Create screens in ^TMP
|
---|
| 162 | ; GBL,^TMP($J,"HLMON",+HLEVIENJ) -- req
|
---|
| 163 | ;
|
---|
| 164 | ;
|
---|
| 165 | N NOPG,NOVAR
|
---|
| 166 | ;
|
---|
| 167 | S X=$G(@GBL@("VX")),NOVAR=$P(X,U),NOPG=$P(X,U,4)
|
---|
| 168 | ;
|
---|
| 169 | ; Vertical alignment?
|
---|
| 170 | I NOPG>1!(NOVAR<6) D MVSCRNV QUIT ;->
|
---|
| 171 | ;
|
---|
| 172 | ; Horizontal alignment...
|
---|
| 173 | D MVSCRNH
|
---|
| 174 | ;
|
---|
| 175 | Q
|
---|
| 176 | ;
|
---|
| 177 | MVSCRNV ; Create variable screen VERTICALly...
|
---|
| 178 | ; Called by MONVSCRN - GBL,HLEVIENJ -- req
|
---|
| 179 | N COL,DATA,EXPL,LEN,TXT,VAR,VARX
|
---|
| 180 | ;
|
---|
| 181 | ; Get widest variable...
|
---|
| 182 | S COL=$O(@GBL@("VY",":"),-1) QUIT:COL'>0 ;->
|
---|
| 183 | S VAR=$O(@GBL@("VY",+COL,"ZZZZZZZZZ"),-1) QUIT:VAR']"" ;->
|
---|
| 184 | S EXPL=$O(@GBL@("VY",+COL,VAR,"ZZZZZZZZZ"),-1) QUIT:EXPL']"" ;->
|
---|
| 185 | S DATA=@GBL@("VD",VAR,EXPL)
|
---|
| 186 | S VARX=$S(VAR'=EXPL:EXPL,1:VAR)
|
---|
| 187 | ;
|
---|
| 188 | ; Find where 'legend: ' should be...
|
---|
| 189 | S TXT=$$CJ^XLFSTR(VARX_"~^~"_DATA,IOM)
|
---|
| 190 | S LEN=$L($P(TXT,"~^~"))-2 ; this is critical number...
|
---|
| 191 | ;
|
---|
| 192 | D ADDLINE("")
|
---|
| 193 | D ADDLINE($$CJ^XLFSTR("-------------------- Variables ----------------------",IOM))
|
---|
| 194 | ;
|
---|
| 195 | ; Loop thru fields now...
|
---|
| 196 | S VAR=""
|
---|
| 197 | F S VAR=$O(@GBL@("VD",VAR)) Q:VAR']"" D
|
---|
| 198 | . S EXPL=""
|
---|
| 199 | . F S EXPL=$O(@GBL@("VD",VAR,EXPL)) Q:EXPL']"" D
|
---|
| 200 | . . S DATA=@GBL@("VD",VAR,EXPL)
|
---|
| 201 | . . S TXT=$$PAD($S(EXPL=VAR:VAR,1:EXPL),LEN)_DATA
|
---|
| 202 | . . D ADDLINE(TXT)
|
---|
| 203 | ;
|
---|
| 204 | Q
|
---|
| 205 | ;
|
---|
| 206 | MVSCRNH ; Create variable screen HORIZONTALly... (Only called if PAGE=1)
|
---|
| 207 | ; Called by MONVSCRN - GBL,HLEVIENJ -- req
|
---|
| 208 | N DATA,EXPL,HDR,NO,TXTHDR,TXTVAR
|
---|
| 209 | ;
|
---|
| 210 | D ADDLINE("")
|
---|
| 211 | D ADDLINE($$CJ^XLFSTR("-------------------- Variables ----------------------",IOM))
|
---|
| 212 | ;
|
---|
| 213 | ; Header
|
---|
| 214 | S VAR="",TXTHDR="",NO=0
|
---|
| 215 | F S VAR=$O(@GBL@("VD",VAR)) Q:VAR']"" D
|
---|
| 216 | . S EXPL=""
|
---|
| 217 | . F S EXPL=$O(@GBL@("VD",VAR,EXPL)) Q:EXPL']"" D
|
---|
| 218 | . . S HDR=$S(EXPL'=VAR:EXPL,1:VAR)
|
---|
| 219 | . . S DATA=@GBL@("VD",VAR,EXPL)
|
---|
| 220 | . . S X=$L(HDR),Y=$L(DATA),LEN=$S(X>Y:X,1:Y)
|
---|
| 221 | . . S NO=NO+1,NO(NO)=LEN_U_HDR_U_DATA
|
---|
| 222 | ;
|
---|
| 223 | ; Header line...
|
---|
| 224 | S NO=0,TXTHDR=""
|
---|
| 225 | F S NO=$O(NO(NO)) Q:NO'>0 D
|
---|
| 226 | . S DATA=NO(+NO)
|
---|
| 227 | . S LEN=+DATA,DATA=$P(DATA,U,2)
|
---|
| 228 | . S TXTHDR=TXTHDR_$S(TXTHDR]"":" ",1:"")
|
---|
| 229 | . S TXTHDR=TXTHDR_$E(DATA_$$REPEAT^XLFSTR(" ",LEN),1,LEN)
|
---|
| 230 | D ADDLINE(TXTHDR)
|
---|
| 231 | ;
|
---|
| 232 | D ADDLINE($$REPEAT^XLFSTR("=",IOM))
|
---|
| 233 | ;
|
---|
| 234 | ; Variables...
|
---|
| 235 | S NO=0,TXTVAR=""
|
---|
| 236 | F S NO=$O(NO(NO)) Q:NO'>0 D
|
---|
| 237 | . S DATA=NO(+NO)
|
---|
| 238 | . S LEN=+DATA,DATA=$P(DATA,U,3)
|
---|
| 239 | . S TXTVAR=TXTVAR_$S(TXTVAR]"":" ",1:"")
|
---|
| 240 | . S TXTVAR=TXTVAR_$E(DATA_$$REPEAT^XLFSTR(" ",LEN),1,LEN)
|
---|
| 241 | D ADDLINE(TXTVAR)
|
---|
| 242 | ;
|
---|
| 243 | Q
|
---|
| 244 | ;
|
---|
| 245 | MONRRD(HLEVIENJ) ; Build RUN DIARY...
|
---|
| 246 | ; GBL,^TMP($J,"HLMON",+HLEVIENJ) -- req
|
---|
| 247 | N NO
|
---|
| 248 | ;
|
---|
| 249 | QUIT:'$D(@GBL@("RUN")) ;->
|
---|
| 250 | ;
|
---|
| 251 | D ADDLINE("")
|
---|
| 252 | D ADDLINE($$CJ^XLFSTR("---------------------- Run Diary ------------------------",IOM))
|
---|
| 253 | ;
|
---|
| 254 | S NO=0
|
---|
| 255 | S NO=$O(@GBL@("RUN",NO)) Q:NO'>0 D
|
---|
| 256 | . D ADDLINE(@GBL@("RUN",+NO))
|
---|
| 257 | ;
|
---|
| 258 | Q
|
---|
| 259 | ;
|
---|
| 260 | ;
|
---|
| 261 | MONMMT(HLEVIENJ) ; Build MSG TEXT...
|
---|
| 262 | ; ^TMP($J,"HLMON",+HLEVIENJ) -- req
|
---|
| 263 | N NO
|
---|
| 264 | ;
|
---|
| 265 | QUIT:'$D(@GBL@("MSG")) ;->
|
---|
| 266 | ;
|
---|
| 267 | D ADDLINE("")
|
---|
| 268 | D ADDLINE($$CJ^XLFSTR("-------------------- Message Text ----------------------",IOM))
|
---|
| 269 | ;
|
---|
| 270 | S NO=0
|
---|
| 271 | S NO=$O(@GBL@("MSG",NO)) Q:NO'>0 D
|
---|
| 272 | . D ADDLINE(@GBL@("MSG",+NO))
|
---|
| 273 | ;
|
---|
| 274 | Q
|
---|
| 275 | ;
|
---|
| 276 | ;
|
---|
| 277 | PAD(VAR,COL) ; Make " var: "
|
---|
| 278 | QUIT:$L(VAR)>(COL-3) VAR_": " ;->
|
---|
| 279 | Q $$REPEAT^XLFSTR(" ",COL-$L(VAR))_VAR_": "
|
---|
| 280 | ;
|
---|
| 281 | ADDLINE(TXT) ; Add line of text...
|
---|
| 282 | N NO
|
---|
| 283 | S NO=$O(@GBL@("VIEW",":"),-1)+1
|
---|
| 284 | S @GBL@("VIEW",+NO)=TXT
|
---|
| 285 | Q
|
---|
| 286 | ;
|
---|
| 287 | ;
|
---|
| 288 | ADD(VAR,COL) ; Add to TXT...
|
---|
| 289 | N VAL
|
---|
| 290 | S VAL=$P($G(@GBL@(VAR)),U,$S(VAR="STATR":4,1:3))
|
---|
| 291 | S TXT=TXT_$S(TXT]"":" ",1:"")_$E(VAL_$$REPEAT^XLFSTR(" ",COL),1,COL)
|
---|
| 292 | Q
|
---|
| 293 | ;
|
---|
| 294 | EOR ;HLEVREP2 - Event Monitor REPORTS ;5/16/03 14:42
|
---|