KMPRPN03 ;SFISC/RAK - Print Package RUM Stats ;29 Oct 1998
;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
EN ;-- entry point.
;
N %ZIS,CONT,DIR,IORVOFF,IORVON,KMPRDATE,KMPRNAM,MESSAGE,POP
N X,Y,ZTDESC,ZTRTN,ZTSAVE,ZTSK
;
D ZIS^KMPRUTL
W @IOF,!?28,IORVON," Package Resource Usage ",IORVOFF,!
W !,?2,"This option will display the package Resource Usage Monitor statistics.",!
W ?2,"The printout summarizes the statistics of the options, protocols and",!
W ?2,"tasks for a selected namespace as percentages.",!!
;
K DIR S DIR(0)="FO^1:999:0^K:X="" "" X"
S DIR("A")="Select Package Namespace (case sensitive)"
D ^DIR Q:Y=""!(Y="^")
S KMPRNAM=Y
;
; determine start date from file 8970.1
D RUMDATES^KMPRUTL(.KMPRDATE)
Q:'KMPRDATE
;
; select output device.
S %ZIS="Q",%ZIS("A")="Device: ",%ZIS("B")="HOME"
W ! D ^%ZIS I POP W !,"No action taken." Q
; if queued.
I $D(IO("Q")) K IO("Q") D Q
.S ZTDESC="RUM Package Resource Usage for '"_KMPRNAM_"'."
.S ZTRTN="EN1^KMPRPN03"
.S ZTSAVE("KMPRDATE")="",ZTSAVE("KMPRNAM")=""
.D ^%ZTLOAD W:$G(ZTSK) !,"Task #",ZTSK
.D EXIT
;
; if output to terminal display message.
W:$E(IOST,1,2)="C-" !?3,"compiling data for: "
;
EN1 ;-- entry point from taskman.
;
Q:'$G(KMPRDATE)
Q:$G(KMPRNAM)=""
;
N DOTS,ELEMENT,KMPRARRY
;
S DOTS=$S($E(IOST,1,2)="C-":0,1:1)
D ELEARRY^KMPRUTL("ELEMENT") Q:'$D(ELEMENT)
S KMPRARRY=$NA(^TMP("KMPR PKG %",$J))
K @KMPRARRY
D PKGDATA^KMPRUTL2(KMPRNAM,$P(KMPRDATE,U),$P(KMPRDATE,U,2),KMPRARRY,DOTS)
D PRINT,EXIT
K @KMPRARRY
;
Q
;
EXIT ;
S:$D(ZTQUEUED) ZTREQ="@"
D ^%ZISC
K KMPUDATE,KMPUNAM
;
Q
;
PRINT ;-- print data from KMPRARRY.
;
Q:'$D(ELEMENT)
Q:$G(KMPRARRY)=""
;
U IO
;
I '$D(@KMPRARRY) D HDR W !,"<<<No Data to Report>>>" Q
;
N DATA,I,NODE,PIECE,SITE,TOTALS,TYP
;
; facility name.
S SITE=$P($$SITE^VASITE,U,2)
S NODE="",CONT=1
F S NODE=$O(@KMPRARRY@(NODE)) Q:NODE="" D Q:'CONT
.D HDR S I=0
.F S I=$O(ELEMENT(I)) Q:'I D Q:'CONT
..W !,$P(ELEMENT(I),U) S PIECE=$P(ELEMENT(I),U,2)
..S TOTALS=$P($G(@KMPRARRY@(NODE,"TOTALS")),U,PIECE)
..F TYP=KMPRNAM,"PRTCL","RPC","HL7","TASK","OTH" D
...S DATA=$P($G(@KMPRARRY@(NODE,TYP)),U,PIECE)
...W ?($S(TYP=KMPRNAM:20,TYP="PRTCL":30,TYP="RPC":40,TYP="HL7":50,TYP="TASK":60,1:70))
...W $J($S('TOTALS:"n/a",1:$FN(DATA/TOTALS*100,"",1)),6)
.;
.; back to NODE level.
.; if no more entries send message else use default.
.S MESSAGE=""
.S:$O(@KMPRARRY@(NODE))="" MESSAGE="Press RETURN to continue"
.W !! D CONTINUE^KMPRUTL(MESSAGE,.CONT)
;
Q
;
HDR ;
W:$Y @IOF
W !?29,"Package Resource Usage"
W !?(80-$L($G(SITE))\2),$G(SITE)
W !?17,"Node ",$G(NODE)," from ",$P(KMPRDATE,U,3)," to ",$P(KMPRDATE,U,4)
W !?(80-($L(KMPRNAM)+12)\2),"'",KMPRNAM,"' Namespace"
W !
W !?20," % ",?30," % ",?40," % ",?50," % ",?60," % ",?70,"All Other"
W !?20,"Options",?30,"Protocols",?40," RPC",?50," HL7",?60," Tasks",?70,"Packages"
W !
;
Q
KMPRPN03 ;SFISC/RAK - Print Package RUM Stats ;29 Oct 1998
+1 ;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
EN ;-- entry point.
+1 ;
+2 NEW %ZIS,CONT,DIR,IORVOFF,IORVON,KMPRDATE,KMPRNAM,MESSAGE,POP
+3 NEW X,Y,ZTDESC,ZTRTN,ZTSAVE,ZTSK
+4 ;
+5 DO ZIS^KMPRUTL
+6 WRITE @IOF,!?28,IORVON," Package Resource Usage ",IORVOFF,!
+7 WRITE !,?2,"This option will display the package Resource Usage Monitor statistics.",!
+8 WRITE ?2,"The printout summarizes the statistics of the options, protocols and",!
+9 WRITE ?2,"tasks for a selected namespace as percentages.",!!
+10 ;
+11 KILL DIR
SET DIR(0)="FO^1:999:0^K:X="" "" X"
+12 SET DIR("A")="Select Package Namespace (case sensitive)"
+13 DO ^DIR
IF Y=""!(Y="^")
QUIT
+14 SET KMPRNAM=Y
+15 ;
+16 ; determine start date from file 8970.1
+17 DO RUMDATES^KMPRUTL(.KMPRDATE)
+18 IF 'KMPRDATE
QUIT
+19 ;
+20 ; select output device.
+21 SET %ZIS="Q"
SET %ZIS("A")="Device: "
SET %ZIS("B")="HOME"
+22 WRITE !
DO ^%ZIS
IF POP
WRITE !,"No action taken."
QUIT
+23 ; if queued.
+24 IF $DATA(IO("Q"))
KILL IO("Q")
Begin DoDot:1
+25 SET ZTDESC="RUM Package Resource Usage for '"_KMPRNAM_"'."
+26 SET ZTRTN="EN1^KMPRPN03"
+27 SET ZTSAVE("KMPRDATE")=""
SET ZTSAVE("KMPRNAM")=""
+28 DO ^%ZTLOAD
IF $GET(ZTSK)
WRITE !,"Task #",ZTSK
+29 DO EXIT
End DoDot:1
QUIT
+30 ;
+31 ; if output to terminal display message.
+32 IF $EXTRACT(IOST,1,2)="C-"
WRITE !?3,"compiling data for: "
+33 ;
EN1 ;-- entry point from taskman.
+1 ;
+2 IF '$GET(KMPRDATE)
QUIT
+3 IF $GET(KMPRNAM)=""
QUIT
+4 ;
+5 NEW DOTS,ELEMENT,KMPRARRY
+6 ;
+7 SET DOTS=$SELECT($EXTRACT(IOST,1,2)="C-":0,1:1)
+8 DO ELEARRY^KMPRUTL("ELEMENT")
IF '$DATA(ELEMENT)
QUIT
+9 SET KMPRARRY=$NAME(^TMP("KMPR PKG %",$JOB))
+10 KILL @KMPRARRY
+11 DO PKGDATA^KMPRUTL2(KMPRNAM,$PIECE(KMPRDATE,U),$PIECE(KMPRDATE,U,2),KMPRARRY,DOTS)
+12 DO PRINT
DO EXIT
+13 KILL @KMPRARRY
+14 ;
+15 QUIT
+16 ;
EXIT ;
+1 IF $DATA(ZTQUEUED)
SET ZTREQ="@"
+2 DO ^%ZISC
+3 KILL KMPUDATE,KMPUNAM
+4 ;
+5 QUIT
+6 ;
PRINT ;-- print data from KMPRARRY.
+1 ;
+2 IF '$DATA(ELEMENT)
QUIT
+3 IF $GET(KMPRARRY)=""
QUIT
+4 ;
+5 USE IO
+6 ;
+7 IF '$DATA(@KMPRARRY)
DO HDR
WRITE !,"<<<No Data to Report>>>"
QUIT
+8 ;
+9 NEW DATA,I,NODE,PIECE,SITE,TOTALS,TYP
+10 ;
+11 ; facility name.
+12 SET SITE=$PIECE($$SITE^VASITE,U,2)
+13 SET NODE=""
SET CONT=1
+14 FOR
SET NODE=$ORDER(@KMPRARRY@(NODE))
IF NODE=""
QUIT
Begin DoDot:1
+15 DO HDR
SET I=0
+16 FOR
SET I=$ORDER(ELEMENT(I))
IF 'I
QUIT
Begin DoDot:2
+17 WRITE !,$PIECE(ELEMENT(I),U)
SET PIECE=$PIECE(ELEMENT(I),U,2)
+18 SET TOTALS=$PIECE($GET(@KMPRARRY@(NODE,"TOTALS")),U,PIECE)
+19 FOR TYP=KMPRNAM,"PRTCL","RPC","HL7","TASK","OTH"
Begin DoDot:3
+20 SET DATA=$PIECE($GET(@KMPRARRY@(NODE,TYP)),U,PIECE)
+21 WRITE ?($SELECT(TYP=KMPRNAM:20,TYP="PRTCL":30,TYP="RPC":40,TYP="HL7":50,TYP="TASK":60,1:70))
+22 WRITE $JUSTIFY($SELECT('TOTALS:"n/a",1:$FNUMBER(DATA/TOTALS*100,"",1)),6)
End DoDot:3
End DoDot:2
IF 'CONT
QUIT
+23 ;
+24 ; back to NODE level.
+25 ; if no more entries send message else use default.
+26 SET MESSAGE=""
+27 IF $ORDER(@KMPRARRY@(NODE))=""
SET MESSAGE="Press RETURN to continue"
+28 WRITE !!
DO CONTINUE^KMPRUTL(MESSAGE,.CONT)
End DoDot:1
IF 'CONT
QUIT
+29 ;
+30 QUIT
+31 ;
HDR ;
+1 IF $Y
WRITE @IOF
+2 WRITE !?29,"Package Resource Usage"
+3 WRITE !?(80-$LENGTH($GET(SITE))\2),$GET(SITE)
+4 WRITE !?17,"Node ",$GET(NODE)," from ",$PIECE(KMPRDATE,U,3)," to ",$PIECE(KMPRDATE,U,4)
+5 WRITE !?(80-($LENGTH(KMPRNAM)+12)\2),"'",KMPRNAM,"' Namespace"
+6 WRITE !
+7 WRITE !?20," % ",?30," % ",?40," % ",?50," % ",?60," % ",?70,"All Other"
+8 WRITE !?20,"Options",?30,"Protocols",?40," RPC",?50," HL7",?60," Tasks",?70,"Packages"
+9 WRITE !
+10 ;
+11 QUIT