HLEVUTI3 ;O-OIFO/LJA - Event Monitor UTILITIES ;02/04/2004 14:42
;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
;
MOVETMP(FILE,IEN,GBLSV) ; Move ^UTILITY data into ^TMP and prep it...
N DATA,FLD,FLDLEN,FLDNM,GBL,MNO,NO,NUM,STR
;
KILL ^TMP($J,"HLTMP")
;
S GBL=$NA(^UTILITY("DIQ1",$J))
;
D ADDLN(GBLSV,$$CJ^XLFSTR(" "_FILE_"#: "_IEN_" ",74,"="))
;
S FLD=0
F S FLD=$O(@GBL@(FILE,IEN,FLD)) Q:FLD'>0 D
. S FLDNM="["_$P($G(^DD(+FILE,+FLD,0)),U)
. S DATA=$G(@GBL@(FILE,IEN,+FLD,"E"))
. I DATA]"" D QUIT ;->
. . S NO=$O(^TMP($J,"HLTMP",":"),-1)+1
. . S ^TMP($J,"HLTMP",+NO)=FLDNM_U_FLD_U_DATA_"]"
. S MNO=0,FLD(1)=FLD
. F S MNO=$O(@GBL@(FILE,IEN,FLD,"E",MNO)) Q:MNO'>0 D
. . S DATA=$G(@GBL@(FILE,IEN,FLD,"E",+MNO))
. . S NO=$O(^TMP($J,"HLTMP",":"),-1)+1
. . S ^TMP($J,"HLTMP",+NO)=FLDNM_U_FLD(1)_U_DATA_"]"
;
S NO=0,STR=""
F S NO=$O(^TMP($J,"HLTMP",NO)) Q:NO'>0 D
. S DATA=^TMP($J,"HLTMP",NO) QUIT:DATA']"" ;->
. S FLDNM=$P(DATA,U),FLD=$P(DATA,U,2),DATA=$P(DATA,U,3,999)
. I FILE=772,FLD=200 S FLDNM="MSG"
. S FLDNM=$S(FLDNM]"":FLDNM_": ",1:""),FLDLEN=$L(FLDNM)
. S DATA=$$LOW^XLFSTR(FLDNM)_DATA
. I FLD']"" D QUIT ;-> standalone line...
. . I STR]"" D ADDLN(GBLSV,STR)
. . D ADDLN(GBLSV," "_DATA)
. I ($L(STR)+$L(DATA)+3)>74 D
. . I STR]"" D ADDLN(GBLSV,STR)
. . S STR=""
. S STR=STR_$$PAD(STR,$L(DATA))_DATA QUIT:$L(STR)<74 ;->
. F D QUIT:STR']""
. . D ADDLN(GBLSV,$E(STR,1,74))
. . S STR=$E(STR,75,999) QUIT:STR']"" ;->
. . S STR=" "_STR
I STR]"" D ADDLN(GBLSV,STR)
;
KILL ^TMP($J,"HLTMP")
;
Q
;
PAD(STR,LEN) ; Add spaces to right justify...
QUIT:STR']"" "" ;->
I ($L(STR)+LEN)<40 QUIT " " ;->
Q $$REPEAT^XLFSTR(" ",74-$L(STR)-LEN)
;
ADDLN(GBLSV,DATA) ; Add one line of text...
N NUM
S NUM=$O(^TMP($J,GBLSV,":"),-1)+1
S ^TMP($J,GBLSV,+NUM)=DATA
Q
;
LASTIEN ; Display last IEN of files 772 & 773 every 15 seconds...
N B,CT,DIFF,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IEN772,IEN773
N LAST772,LAST773,STOP,TIMEOUT,X,Y
;
W @IOF,$$CJ^XLFSTR("File 772 & 773 IEN Display",IOM)
W !,$$REPEAT^XLFSTR("=",IOM)
;
W !!,"This API displays the last internal entry number (IEN) in the following files:"
W !!," * HL Message Text file (#772)."
W !," * HL Message Administration file (#773)."
W !!,"The last IEN in these files are recollected and redisplayed every 15 seconds."
W !,"After every display of these IENs, you may take the following actions:"
W !!," * Do nothing, & the information will be redisplayed in 15 seconds."
W !," (You may change the refresh seconds by entering a number of seconds"
W !," and pressing RETURN.)"
W !!," * Hit return to force information redisplay."
W !!," * Enter an uparrow ('^') and press RETURN to exit."
;
F QUIT:($Y+3)>IOSL W !
QUIT:$$BTE^HLCSMON("Press RETURN to start, or '^' to exit... ") ;->
;
W @IOF
S X=$$SITE^VASITE W $$CJ^XLFSTR(" "_$P(X,U,2)_" ["_$P(X,U,3)_"] ",IOM,"=")
D HDRIEN
;
S CT=0,TIMEOUT=15,B="|"
S (IEN772,IEN773,LAST772,LAST773)=""
;
F D QUIT:STOP
. S CT=CT+1
. S IEN772=$O(^HL(772,":"),-1),IEN773=$O(^HLMA(":"),-1)
. I '(CT#22) W !! D HDRIEN
. W !,$$SDT($$NOW^XLFDT),?19,B
. W ?21,IEN772,?36,$$DIFFIEN(IEN772,LAST772),?45,B
. W ?47,IEN773,?61,$$DIFFIEN(IEN773,LAST773),?73,B
. S LAST772=IEN772,LAST773=IEN773
. S STOP=1
. R " ",X:TIMEOUT
. QUIT:X[U ;->
. S STOP=0
. QUIT:'$T ;-> Timed out...
. I X=+X,X>0 S TIMEOUT=X D QUIT ;->
. . W """"
. ; User pressed RETURN...
. W "<ret>"
;
Q
;
DIFFIEN(LAST,BEFORE) ; Return number new entries right justified in 3 col's
N DIFF
QUIT:LAST'>0!(BEFORE'>0) "" ;->
S DIFF=LAST-BEFORE QUIT:DIFF'>0 "" ;->
QUIT $J(DIFF,3)
;
HDRIEN ;
N B
S B="|"
W:$X>0 !
W "Time",?19,B,?21,"LAST-772-IEN",?36,"#772",?45,B
W ?47,"LAST-773-IEN",?61,"#773",?73,B
W !,$$REPEAT^XLFSTR("=",IOM)
Q
;
SDT(FMTIME) ; Return DD/MM/YY@HH:MM:SS
N DATE,TIME
QUIT:$G(FMTIME)'?7N.E "" ;->
S TIME=$S(FMTIME?7N1"."1.N:"@"_$E($P($$FMTE^XLFDT(FMTIME),"@",2)_":00:00",1,8),1:"")
S DATE=$E(FMTIME,4,5)_"/"_$E(FMTIME,6,7)_"/"_$E(FMTIME,2,3)
Q DATE_TIME
;
EOR ;HLEVUTI3 - Event Monitor UTILITIES ;5/16/03 14:42
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLEVUTI3 4284 printed Dec 13, 2024@01:58:02 Page 2
HLEVUTI3 ;O-OIFO/LJA - Event Monitor UTILITIES ;02/04/2004 14:42
+1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
+2 ;
MOVETMP(FILE,IEN,GBLSV) ; Move ^UTILITY data into ^TMP and prep it...
+1 NEW DATA,FLD,FLDLEN,FLDNM,GBL,MNO,NO,NUM,STR
+2 ;
+3 KILL ^TMP($JOB,"HLTMP")
+4 ;
+5 SET GBL=$NAME(^UTILITY("DIQ1",$JOB))
+6 ;
+7 DO ADDLN(GBLSV,$$CJ^XLFSTR(" "_FILE_"#: "_IEN_" ",74,"="))
+8 ;
+9 SET FLD=0
+10 FOR
SET FLD=$ORDER(@GBL@(FILE,IEN,FLD))
if FLD'>0
QUIT
Begin DoDot:1
+11 SET FLDNM="["_$PIECE($GET(^DD(+FILE,+FLD,0)),U)
+12 SET DATA=$GET(@GBL@(FILE,IEN,+FLD,"E"))
+13 ;->
IF DATA]""
Begin DoDot:2
+14 SET NO=$ORDER(^TMP($JOB,"HLTMP",":"),-1)+1
+15 SET ^TMP($JOB,"HLTMP",+NO)=FLDNM_U_FLD_U_DATA_"]"
End DoDot:2
QUIT
+16 SET MNO=0
SET FLD(1)=FLD
+17 FOR
SET MNO=$ORDER(@GBL@(FILE,IEN,FLD,"E",MNO))
if MNO'>0
QUIT
Begin DoDot:2
+18 SET DATA=$GET(@GBL@(FILE,IEN,FLD,"E",+MNO))
+19 SET NO=$ORDER(^TMP($JOB,"HLTMP",":"),-1)+1
+20 SET ^TMP($JOB,"HLTMP",+NO)=FLDNM_U_FLD(1)_U_DATA_"]"
End DoDot:2
End DoDot:1
+21 ;
+22 SET NO=0
SET STR=""
+23 FOR
SET NO=$ORDER(^TMP($JOB,"HLTMP",NO))
if NO'>0
QUIT
Begin DoDot:1
+24 ;->
SET DATA=^TMP($JOB,"HLTMP",NO)
if DATA']""
QUIT
+25 SET FLDNM=$PIECE(DATA,U)
SET FLD=$PIECE(DATA,U,2)
SET DATA=$PIECE(DATA,U,3,999)
+26 IF FILE=772
IF FLD=200
SET FLDNM="MSG"
+27 SET FLDNM=$SELECT(FLDNM]"":FLDNM_": ",1:"")
SET FLDLEN=$LENGTH(FLDNM)
+28 SET DATA=$$LOW^XLFSTR(FLDNM)_DATA
+29 ;-> standalone line...
IF FLD']""
Begin DoDot:2
+30 IF STR]""
DO ADDLN(GBLSV,STR)
+31 DO ADDLN(GBLSV," "_DATA)
End DoDot:2
QUIT
+32 IF ($LENGTH(STR)+$LENGTH(DATA)+3)>74
Begin DoDot:2
+33 IF STR]""
DO ADDLN(GBLSV,STR)
+34 SET STR=""
End DoDot:2
+35 ;->
SET STR=STR_$$PAD(STR,$LENGTH(DATA))_DATA
if $LENGTH(STR)<74
QUIT
+36 FOR
Begin DoDot:2
+37 DO ADDLN(GBLSV,$EXTRACT(STR,1,74))
+38 ;->
SET STR=$EXTRACT(STR,75,999)
if STR']""
QUIT
+39 SET STR=" "_STR
End DoDot:2
if STR']""
QUIT
End DoDot:1
+40 IF STR]""
DO ADDLN(GBLSV,STR)
+41 ;
+42 KILL ^TMP($JOB,"HLTMP")
+43 ;
+44 QUIT
+45 ;
PAD(STR,LEN) ; Add spaces to right justify...
+1 ;->
if STR']""
QUIT ""
+2 ;->
IF ($LENGTH(STR)+LEN)<40
QUIT " "
+3 QUIT $$REPEAT^XLFSTR(" ",74-$LENGTH(STR)-LEN)
+4 ;
ADDLN(GBLSV,DATA) ; Add one line of text...
+1 NEW NUM
+2 SET NUM=$ORDER(^TMP($JOB,GBLSV,":"),-1)+1
+3 SET ^TMP($JOB,GBLSV,+NUM)=DATA
+4 QUIT
+5 ;
LASTIEN ; Display last IEN of files 772 & 773 every 15 seconds...
+1 NEW B,CT,DIFF,DIR,DIROUT,DIRUT,DTOUT,DUOUT,IEN772,IEN773
+2 NEW LAST772,LAST773,STOP,TIMEOUT,X,Y
+3 ;
+4 WRITE @IOF,$$CJ^XLFSTR("File 772 & 773 IEN Display",IOM)
+5 WRITE !,$$REPEAT^XLFSTR("=",IOM)
+6 ;
+7 WRITE !!,"This API displays the last internal entry number (IEN) in the following files:"
+8 WRITE !!," * HL Message Text file (#772)."
+9 WRITE !," * HL Message Administration file (#773)."
+10 WRITE !!,"The last IEN in these files are recollected and redisplayed every 15 seconds."
+11 WRITE !,"After every display of these IENs, you may take the following actions:"
+12 WRITE !!," * Do nothing, & the information will be redisplayed in 15 seconds."
+13 WRITE !," (You may change the refresh seconds by entering a number of seconds"
+14 WRITE !," and pressing RETURN.)"
+15 WRITE !!," * Hit return to force information redisplay."
+16 WRITE !!," * Enter an uparrow ('^') and press RETURN to exit."
+17 ;
+18 FOR
if ($Y+3)>IOSL
QUIT
WRITE !
+19 ;->
if $$BTE^HLCSMON("Press RETURN to start, or '^' to exit... ")
QUIT
+20 ;
+21 WRITE @IOF
+22 SET X=$$SITE^VASITE
WRITE $$CJ^XLFSTR(" "_$PIECE(X,U,2)_" ["_$PIECE(X,U,3)_"] ",IOM,"=")
+23 DO HDRIEN
+24 ;
+25 SET CT=0
SET TIMEOUT=15
SET B="|"
+26 SET (IEN772,IEN773,LAST772,LAST773)=""
+27 ;
+28 FOR
Begin DoDot:1
+29 SET CT=CT+1
+30 SET IEN772=$ORDER(^HL(772,":"),-1)
SET IEN773=$ORDER(^HLMA(":"),-1)
+31 IF '(CT#22)
WRITE !!
DO HDRIEN
+32 WRITE !,$$SDT($$NOW^XLFDT),?19,B
+33 WRITE ?21,IEN772,?36,$$DIFFIEN(IEN772,LAST772),?45,B
+34 WRITE ?47,IEN773,?61,$$DIFFIEN(IEN773,LAST773),?73,B
+35 SET LAST772=IEN772
SET LAST773=IEN773
+36 SET STOP=1
+37 READ " ",X:TIMEOUT
+38 ;->
if X[U
QUIT
+39 SET STOP=0
+40 ;-> Timed out...
if '$TEST
QUIT
+41 ;->
IF X=+X
IF X>0
SET TIMEOUT=X
Begin DoDot:2
+42 WRITE """"
End DoDot:2
QUIT
+43 ; User pressed RETURN...
+44 WRITE "<ret>"
End DoDot:1
if STOP
QUIT
+45 ;
+46 QUIT
+47 ;
DIFFIEN(LAST,BEFORE) ; Return number new entries right justified in 3 col's
+1 NEW DIFF
+2 ;->
if LAST'>0!(BEFORE'>0)
QUIT ""
+3 ;->
SET DIFF=LAST-BEFORE
if DIFF'>0
QUIT ""
+4 QUIT $JUSTIFY(DIFF,3)
+5 ;
HDRIEN ;
+1 NEW B
+2 SET B="|"
+3 if $X>0
WRITE !
+4 WRITE "Time",?19,B,?21,"LAST-772-IEN",?36,"#772",?45,B
+5 WRITE ?47,"LAST-773-IEN",?61,"#773",?73,B
+6 WRITE !,$$REPEAT^XLFSTR("=",IOM)
+7 QUIT
+8 ;
SDT(FMTIME) ; Return DD/MM/YY@HH:MM:SS
+1 NEW DATE,TIME
+2 ;->
if $GET(FMTIME)'?7N.E
QUIT ""
+3 SET TIME=$SELECT(FMTIME?7N1"."1.N:"@"_$EXTRACT($PIECE($$FMTE^XLFDT(FMTIME),"@",2)_":00:00",1,8),1:"")
+4 SET DATE=$EXTRACT(FMTIME,4,5)_"/"_$EXTRACT(FMTIME,6,7)_"/"_$EXTRACT(FMTIME,2,3)
+5 QUIT DATE_TIME
+6 ;
EOR ;HLEVUTI3 - Event Monitor UTILITIES ;5/16/03 14:42