Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HLEVUTI1

HLEVUTI1.m

Go to the documentation of this file.
  1. HLEVUTI1 ;OIFO-O/LJA - Event Monitor UTILITIES ;02/04/2004 14:42
  1. ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
  1. ;;
  1. ;
  1. ; Utility to aid in displaying 870 data...
  1. ;
  1. CTRL ;
  1. N ABRT,CT,CONT,DATA,DATE,DIC,GBL,HD,IOINHI,IOINORM,L870,LAST
  1. N LNM,LNO,LNS,N,NO,NODE,TOT,TXT,WAY,WHAT,X,Y
  1. ;
  1. S X="IOINHI;IOINORM" D ENDR^%ZISS
  1. CTRL0 W @IOF,$$CJ^XLFSTR("Logical Link Display",IOM),!,$$REPEAT^XLFSTR("=",IOM)
  1. D QUEUES
  1. W ! S L870=$$LINK Q:'L870
  1. S GBL="^HLCS(870,"_L870_")"
  1. S LNM=$$LNM(L870)
  1. W " ",LNM
  1. CTRL1 D SHOWHD(LNM,L870)
  1. W !!,"What information for IN and OUT QUEUEs do you want to see?"
  1. W !!,"1 Show IENs",!,"2 Show Summary nodes",!,"3 Totals",!,"4 Dots",!,"5 Find skips",!,"6 Message date search"
  1. R !!,"Enter #: ",WHAT:99 G:WHAT<1!(WHAT>6) CTRL0 ;->
  1. W !!,$$CJ^XLFSTR(" "_IOINHI_LNM_IOINORM_" ",IOM+$L(IOINHI)+$L(IOINORM),"=")
  1. S ABRT=0,CONT=0,CT=0
  1. S WAY=$$ASKWAY QUIT:WAY[U ;->
  1. S NO=$$ASKNO(LNM,L870,WAY) QUIT:NO[U ;->
  1. I WHAT=6 D SEARCH(L870,WAY,NO) G CTRL1 ;->
  1. S TOT(WAY)=0,LAST=""
  1. QUIT:$O(@GBL@(WAY,0))'>0 ;->
  1. W !,$$CJ^XLFSTR(" "_$S(WAY=1:"IN",1:"OUT")_" QUEUE ",IOM,"-")
  1. I WHAT=3 W !,"Totaling..."
  1. F S NO=$O(@GBL@(WAY,NO)) Q:'NO!ABRT D
  1. . S CT=CT+1
  1. . S NODE=$G(@GBL@(WAY,NO,0)),DATE=$P($G(@GBL@(WAY,NO,1,0)),U,5)
  1. . S TXT=$G(@GBL@(WAY,NO,1,1,0))
  1. . S TXT=$E(DATE_" ",1,10)_$E(NODE_" ",1,12)_" "_$E(TXT,1,56)
  1. . I WHAT=1 W:($X+$L(NO)+1)>IOM ! W:$X>0 "," W NO
  1. . I WHAT=2 D
  1. . . W !,TXT
  1. . I WHAT=3 W:'(CT#5000) "." S TOT(WAY)=TOT(WAY)+1
  1. . I WHAT=4 Q:$$CT W "."
  1. . I WHAT=5 D
  1. . . I LAST,+LAST'=(NO-1) D
  1. . . . W !,+LAST,?10," ",$E($P(LAST,"~",2,999),1,IOM-$X)
  1. . . . W !,+NO,?10," ",$E(TXT,1,69)
  1. . . S LAST=NO_"~"_TXT
  1. . I 'CONT,'(CT#20) R X:999 S:X[U ABRT=1 S:X=" " CONT=1
  1. I 'ABRT,TOT(WAY) W !,"--- Total = #",TOT(WAY)
  1. S ABRT="",CT=0
  1. ;
  1. R !,"End of output... ",X:999
  1. ;
  1. W !!,$$CJ^XLFSTR(" "_LNM_" ",IOM,"=")
  1. ;
  1. G CTRL1 ;->
  1. ;
  1. SHOWHD(LNM,L870) ; Show summary information...
  1. N NODE
  1. W !!,$$REPEAT^XLFSTR("=",IOM)
  1. F NODE=0,100,200,300,400,"IN QUEUE BACK POINTER","IN QUEUE FRONT POINTER","OUT QUEUE BACK POINTER","OUT QUEUE FRONT POINTER" D
  1. . S DATA=$G(@GBL@(NODE)) Q:DATA']"" ;->
  1. . D PHD(NODE,DATA)
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. Q
  1. ;
  1. CT() QUIT:(CT#500) ""
  1. R X:999 Q:X']"" ""
  1. S ABRT=1
  1. Q 1
  1. ;
  1. PHD(HD,DATA) ;
  1. S HD=$$HD(HD)
  1. S HD=$E(" ",1,4-$L(HD))_HD
  1. W !,HD,"="
  1. F D QUIT:DATA']""
  1. . QUIT:DATA']""
  1. . W $E(DATA,1,76)
  1. . S DATA=$E(DATA,77,999)
  1. . W:DATA]"" !,?4
  1. Q
  1. ;
  1. HD(HD) ;
  1. I HD["IN QUEUE F" S HD="IQFP"
  1. I HD["IN QUEUE B" S HD="IQBP"
  1. I HD["OUT QUEUE F" S HD="OQFP"
  1. I HD["OUT QUEUE B" S HD="OQBP"
  1. Q HD
  1. ;
  1. S DIC=870,DIC(0)="AEMQN",DIC("A")="Select LINK: "
  1. D ^DIC
  1. QUIT $S(+Y:+Y,1:"")
  1. ;
  1. QUEUES N LNM,LNO
  1. KILL ^TMP($J,"ZZLJA")
  1. S LNM=""
  1. F S LNM=$O(^HLCS(870,"B",LNM)) Q:LNM']"" D
  1. . S LNO=0
  1. . F S LNO=$O(^HLCS(870,"B",LNM,LNO)) Q:'LNO D
  1. . . S LNS=$$LNM(LNO)
  1. . . I $O(^HLCS(870,+LNO,1,0))>0 D
  1. . . . S ^TMP($J,"ZZLJA",LNS,1)=$P($G(^HLCS(870,+LNO,1,0)),U,3)
  1. . . I $O(^HLCS(870,+LNO,2,0))>0 D
  1. . . . S ^TMP($J,"ZZLJA",LNS,2)=$P($G(^HLCS(870,+LNO,2,0)),U,3)
  1. ;
  1. W !!,"Links with queues"
  1. W !,"Link",?30,"IQ Totals",?45,"OQ Totals"
  1. W !,$$REPEAT^XLFSTR("-",IOM)
  1. ;
  1. S LNS=""
  1. F S LNS=$O(^TMP($J,"ZZLJA",LNS)) Q:LNS']"" D
  1. . W !
  1. . W:LNS["Mail]" IOINHI W $E(LNS_" --------------------",1,20),IOINORM
  1. . F WAY=1,2 D
  1. . . S TOT=$G(^TMP($J,"ZZLJA",LNS,WAY))
  1. . . S TOT=$E("---------------",1,15-$L(TOT))_TOT
  1. . . W TOT
  1. ;
  1. KILL ^TMP($J,"ZZLJA")
  1. ;
  1. Q
  1. ;
  1. LNM(L870) N GBL,X
  1. S GBL="^HLCS(870,"_L870_")",X=$G(@GBL@(0))
  1. Q $P(X,U)_" #"_L870_" ["_$P("Mail^HLLP^X3.28^TCP",U,+$P(X,U,3))_"] "
  1. ;
  1. ASKNO(LNM,L870,WAY) ; Ask for beginning IEN to display...
  1. N DIR,DIRUT,DTOUT,DUOUT,FIRST,LAST,X,Y
  1. S FIRST=$O(^HLCS(870,+L870,WAY,0))
  1. S LAST=$O(^HLCS(870,+L870,WAY,":"),-1)
  1. W !!,"First IEN = ",FIRST
  1. W !," Last IEN = ",LAST
  1. W !
  1. S DIR(0)="N^"_FIRST_":"_LAST,DIR("A")="Enter IEN"
  1. I FIRST S DIR("B")=FIRST
  1. D ^DIR
  1. QUIT:$D(DIRUT)!($D(DTOUT))!($D(DUOUT)) U ;->
  1. QUIT:+Y>0 (+Y-1) ;-> Will be used for $ORDER
  1. Q 0
  1. ;
  1. ASKWAY() ; In or Out...
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="S^1:Inbound Queue;2:Outbound Queue"
  1. S DIR("A")="Select QUEUE"
  1. D ^DIR
  1. QUIT:+Y>0&(+Y<3) $P("1^2",U,+Y)
  1. Q U
  1. ;
  1. ; LNM -- req
  1. N ABRT,CONT,CT,NUM
  1. I '$D(SKIP) N SKIP
  1. S1 S SKIP=$S($G(SKIP):+SKIP,1:5000),ABRT=0,CT=0,CONT=0
  1. S NUM=NO-1,NUM=$O(^HLCS(870,+L870,WAY,NUM))
  1. W !!
  1. D SRCH1(L870,WAY,+NUM)
  1. F D QUIT:NUM'>0!(ABRT)
  1. . S NUM=NUM+SKIP
  1. . S NUM=$O(^HLCS(870,+L870,WAY,NUM)) QUIT:NUM'>0 ;->
  1. . D SRCH1(L870,WAY,+NUM)
  1. W !,"Just completed a search using a starting point of IEN=",NO,", and an offset"
  1. W !,"of #",SKIP,". You may now enter a new starting IEN and offset."
  1. W !
  1. S NO=$$ASKNO(LNM,L870,WAY) QUIT:NO[U ;->
  1. R !,"Enter OFFSET: ",OFFSET:90 I OFFSET>0 S SKIP=OFFSET G S1 ;->
  1. Q
  1. ;
  1. SRCH1(L870,WAY,IEN) ; Show date of entry...
  1. N MSH,DATE,DEL
  1. S MSH=$G(^HLCS(870,+L870,WAY,IEN,1,1,0))
  1. S DEL=$E(MSH,4),DATE=$P(MSH,DEL,7)
  1. S DATE=$S(DATE?14N.1"-".N:$$HTFM^XLFDT(DATE),1:"")
  1. S DATE=$S(DATE?7N.E:DATE,1:$P($G(^HLCS(870,+L870,WAY,IEN,1,0)),U,5))
  1. QUIT:DATE'?7N.E ;->
  1. W $J($$SDT(DATE)_"(#"_IEN_")",18)_" "
  1. S CT=CT+1
  1. I 'CONT,'(CT#80) R X:999 S:X[U ABRT=1 S:X=" " CONT=1
  1. Q
  1. ;
  1. SDT(DATE) ; Return shortened form of date...
  1. I DATE?7N QUIT $E(DATE,4,5)_"/"_$E(DATE,6,7)_"/"_$E(DATE,2,3) ;->
  1. I DATE?7N1"."1.N QUIT $E(DATE,4,5)_"/"_$E(DATE,6,7)_"/"_$E(DATE,2,3)_"@"_$E($P($$FMTE^XLFDT(DATE),"@",2),1,5)
  1. QUIT ""
  1. ;
  1. TEST ; Hardwire IENs and test M code in monitor (only)...
  1. N IEN,MCODE,STATE,WAY
  1. ;
  1. W @IOF,$$CJ^XLFSTR("Monitor Test Utility",IOM)
  1. W !,$$REPEAT^XLFSTR("=",IOM)
  1. W !,"This utility sets the ^TMP(""HLEVFLAG"",$J) node to ""STOP"" to avoid any"
  1. W !,"Event Monitor activity. This enables the debugging of M code."
  1. ;
  1. S STATE=$G(^TMP("HLEVFLAG",$J))
  1. ;
  1. F D QUIT:'IEN
  1. . W !
  1. . S IEN=$$ASKIEN^HLEVREP(776.1) QUIT:'IEN ;->
  1. .
  1. . S MCODE=$TR($P($G(^HLEV(776.1,+IEN,0)),U,6),"~",U)
  1. . I MCODE']"" W " no M code found..." QUIT ;->
  1. . W !!,"M code = ",MCODE
  1. .
  1. . W !!,"You may ZG ",MCODE," or D ",MCODE,"..."
  1. . W !
  1. . S WAY=$$YN^HLCSRPT4("DO the MCODE","Yes")
  1. . S WAY=$S(WAY=1:1,1:2) ; 1=DO, 2=ZG
  1. .
  1. . W !
  1. . I '$$YN^HLCSRPT4("OK to test now","Yes") D QUIT ;->
  1. . . W " no action taken..."
  1. .
  1. . S ^TMP("HLEVFLAG",$J)="STOP"
  1. .
  1. . D TESTRUN
  1. .
  1. . KILL ^TMP("HLEVFLAG",$J)
  1. . W !!,$$REPEAT^XLFSTR("-",IOM)
  1. ;
  1. I STATE]"" S ^TMP("HLEVFLAG",$J)=STATE
  1. ;
  1. Q
  1. ;
  1. TESTRUN ; Call here from above to avoid LEVEL ERRORs with ZGo...
  1. ; MCODE,WAY -- req
  1. I WAY=1 D
  1. . W " DOing ",MCODE,"... "
  1. . D @MCODE
  1. I WAY=2 D
  1. . W " ZGOing ",MCODE,"... "
  1. . X "ZG "_@MCODE
  1. Q
  1. ;
  1. COLLECT(I772) ; Collect 772 & 773 data...
  1. N CT,I773
  1. D ADD(""),ADD($$CJ^XLFSTR(" 772# "_I772_" ",74,"-"))
  1. S I773=0,CT=0
  1. F S I773=$O(^TMP($J,"HLIEN",IEN,I773)) Q:'I773 D
  1. . I CT>0 D ADD("")
  1. . D COLL773(+I773)
  1. . S CT=CT+1
  1. D ADD($$CJ^XLFSTR("----------------------------------------",74))
  1. D COLL772(+I772)
  1. Q
  1. ;
  1. COLL773(I773) ;
  1. N LP,ST
  1. S LP="^HLMA("_I773,ST=LP_",",LP=LP_")"
  1. F S LP=$Q(@LP) Q:LP'[ST D
  1. . D ADD(LP_"="_@LP)
  1. Q
  1. ;
  1. COLL772(I772) ;
  1. N CT,LASTIN,LP,ST
  1. S LP="^HL(772,"_I772,ST=LP_",",LP=LP_")",CT=0,LASTIN=""
  1. F S LP=$Q(@LP) Q:LP'[ST D
  1. . I $TR(LP,"""","")?1"^HL(772,"1.N1",IN,"1.N.E D QUIT:CT>5 ;->
  1. . . S CT=CT+1
  1. . . I CT=7 D ADD("... some data not shown ...")
  1. . . S LASTIN=LP
  1. . D ADD(LP_"="_@LP)
  1. I LASTIN]"",CT>6 D ADD(LASTIN_"="_@LASTIN)
  1. Q
  1. ;
  1. ADD(TXT) ; Add text for report...
  1. ; SCRN -- req
  1. N NO,POSX
  1. S POSX=$L($P(TXT,"="))+1
  1. F D QUIT:TXT']""
  1. . I 'SCRN D ; Store for email message...
  1. . . S NO=$O(^TMP($J,"HLMAIL",":"),-1)+1
  1. . . S ^TMP($J,"HLMAIL",+NO)=$E(TXT,1,74)
  1. . I SCRN W !,$E(TXT,1,74) ; Display on-screen
  1. . S TXT=$E(TXT,75,999) QUIT:TXT']"" ;->
  1. . S TXT=$$REPEAT^XLFSTR(" ",$S(POSX:POSX,1:5))_TXT
  1. Q
  1. ;
  1. DOLRO(TAG,SNO) ; Store debug data in ^XTMP("HLEVUTI1 "_DT,NO)...
  1. N NO,X,XTMP
  1. ;
  1. S XTMP="HLEVUTI1 "_TAG_"-"_DT
  1. S:'$D(^XTMP(XTMP,0)) ^XTMP(XTMP,0)=$$FMADD^XLFDT(DT,1)_U_$$NOW^XLFDT_"^Debug data created by DOLRO~HLEVUTI1"
  1. ;
  1. S NO=$O(^XTMP(XTMP,":"),-1)+1,NO=$S(NO>($G(SNO)-1):NO,1:SNO)
  1. ;
  1. S X="^XTMP("""_XTMP_""","_NO_"," D DOLRO^%ZOSV
  1. ;
  1. Q
  1. ;
  1. EOR ;HLEVUTI1 - Event Monitor UTILITIES ;5/16/03 14:42