KMPRUTL ;SFISC/KAK/RAK - Resource Usage Monitor Utilities ;2/29/00 10:29
;;1.0;CAPACITY MANAGEMENT - RUM;**1,2**;Dec 09, 1998
;
CONTINUE(KMPRMSSG,KMPRY) ;-- press return to continue
;---------------------------------------------------------------------
; KMPRMSSG. (optional) Message to display to user (if not defined then
; default message by ^DIR is used).
; KMPRY.... Return value: 0 - do not continue.
; 1 - continue.
; Access by reference.
;---------------------------------------------------------------------
;
S KMPRMSSG=$G(KMPRMSSG),KMPRY=0
;
; if not terminal continue without displaying message.
I $E(IOST,1,2)'="C-" S KMPRY=1 Q
;
N DIR,X,Y
S DIR(0)="EO"
S:KMPRMSSG]"" DIR("A")=KMPRMSSG
D ^DIR
S KMPRY=+$G(Y)
;
Q
;
GRPHMSG ;-- graph message.
N TXT
S TXT(1)="This option displays data in a graphical format. Please make"
S TXT(2)="note that this output is intended for comparison/trends only,"
S TXT(3)="and should not be used for detailed analysis."
S TXT(1,"F")="!?9",TXT(2,"F")="!?9",TXT(3,"F")="!?9"
D EN^DDIOL(.TXT)
Q
;
HDR ; entry point to print header
; Input variables:
; KMPRPG = page number
; KMPRTL = title to print on header
; KMPRRP = reporting period date
; = print today's date (if NOT defined)
D PRESS Q:KMPROUT
W:'($E(IOST,1,2)'="C-"&'KMPRPG) @IOF I ($E(IOST,1,2)="P-"&$D(IO("S"))&'KMPRPG) S (DX,DY)=0 X ^%ZOSF("XY")
I IOT="HFS"!($E(IOST,1,2)="P-") S (IORVOFF,IORVON)=""
S KMPRPG=KMPRPG+1 W !,?((IOM/2)-(($L(KMPRTL)+4)/2)),IORVON,"* ",KMPRTL," *",IORVOFF
I $D(KMPRRP) W !,?((IOM/2)-(($L(A1RP)+18)/2)),"Reporting Period: ",KMPRRP
E S Y=DT D DD^%DT W !,?((IOM/2)-(($L(Y)+12)/2)),"Printed on: ",Y
W:$E(IOST,1,2)'="C-" ?(IOM-9),"Page ",$J(KMPRPG,3) W !!
Q
;
ID(KMPRIEN) ;-- display - called from ^DD(8971.1,0,"ID","W")
;-----------------------------------------------------------------------
; KMPRIEN... Ien for file #8971.1 (RESOURCE USAGE MONITOR).
;-----------------------------------------------------------------------
Q:'$G(KMPRIEN)
Q:'$D(^KMPR(8971.1,+KMPRIEN,0))
N DATA,TXT
S DATA=$G(^KMPR(8971.1,+KMPRIEN,0))
; sent to cm national database.
S TXT(1)=$S($P(DATA,U,2):"sent",1:"not sent")
S TXT(1)=TXT(1)_$J(" ",10-$L(TXT(1)))
; node.
S TXT(1)=TXT(1)_$P(DATA,U,3)
S TXT(1)=TXT(1)_$J(" ",22-$L(TXT(1)))
; option.
I $P(DATA,U,4)]"" S TXT(1)=TXT(1)_"option: "_$P(DATA,U,4)
; rpc.
E I $P(DATA,U,7)]"" S TXT(1)=TXT(1)_" rpc: "_$P(DATA,U,7)
S TXT(1,"F")="?16"
; if protocol
I $P(DATA,U,5)'="" D
.S TXT(2)="protocol: "_$E($P(DATA,U,5),1,40) ;_" (protocol)"
.S TXT(2,"F")="!?"_$S($G(DDSDIW):36,1:45)
; display TXT() array.
D EN^DDIOL(.TXT)
Q
;
PRESS ;
I KMPRPG,$E(IOST,1,2)="C-" W !,"Press RETURN to continue or '^' to exit: " R X:DTIME S:X="^"!('$T) KMPROUT=1
Q
;
NODEARRY(KMPRARRY) ;-- put nodes into array.
;-----------------------------------------------------------------------
; KMPRARRY.. Array to contain nodes in format:
; KMPRARRY(NODENAME)=""
;-----------------------------------------------------------------------
;
K @KMPRARRY
;
N NODE S NODE=""
F S NODE=$O(^KMPR(8971.1,"ANODE",NODE)) Q:NODE="" S @KMPRARRY@(NODE)=""
Q
;
RUMDATES(KMPRDATE) ;-- get RUM date ranges from file 8971.1
;---------------------------------------------------------------------
; KMPRDATE... Return value (access by reference) in format:
; StartDate^EndDate^ExtStartDate^ExtEndDate
; 2981101^2981104^Nov 1, 1998^Nov 4, 1998
;---------------------------------------------------------------------
;
S KMPRDATE=""
N END,START
; determine start date from file 8971.1
S START=$O(^KMPR(8971.1,"B",0))
; determine end date from file 8971.1
S END=$O(^KMPR(8971.1,"B","A"),-1)
D DATERNG^KMPUTL1(.KMPRDATE,START,END)
;
Q
;
VERSION() ;-- extrinsic - return current version.
Q $P($T(+2^KMPRUTL),";",3)_"^"_$P($T(+2^KMPRUTL),";",5)
;
ZIS ; entry point to define IORVOFF and IORVON variables
D HOME^%ZIS S X="IORVOFF;IORVON" D ENDR^%ZISS
S:IOT="HFS" (IORVOFF,IORVON)=""
Q
;
;
ELEARRY(KMPRARRY) ;-- set elements data into KMPRARRY.
;-----------------------------------------------------------------------
; KMPRARRY... Array to contain elements data.
; Format: ElementName^DataPiece
; KMPRARRY(1)=CPU Time^1
; KMPRARRY(2)=Elapsed Time^7
; KMPRARRY(...)=...
;-----------------------------------------------------------------------
;
Q:$G(KMPRARRY)=""
;
N DATA,I
F I=1:1 Q:$P($T(ELEMENTS+I),";",3)="" D
.S DATA=$T(ELEMENTS+I)
.S @KMPRARRY@(I)=$P(DATA,";",3)_"^"_$P(DATA,";",4)
Q
;
ELEMENT(KMPUVAR) ;-- select RUM data element.
; Output Variable:
; KMPUVAR = Number of Data Piece
; = '^' if DTOUT or DUOUT
; KMPUVAR(0) = Set of Code's Verbiage
;
N DIR,DTOUT,DUOUT,I,X,Y
S KMPUVAR=""
S DIR(0)="SXO^"
F I=1:1 Q:$P($T(ELEMENTS+I),";",3)="" D
.S DIR(0)=DIR(0)_I_":"_$P($T(ELEMENTS+I),";",3)_";"
S DIR("A")="Enter Key Data Element for Searching RUM Data"
D ^DIR I $D(DTOUT)!$D(DUOUT)!(Y="") S KMPUVAR="^",KMPUVAR(0)="" Q
S KMPUVAR=$TR(Y,"12345678^","17562348^"),KMPUVAR(0)=Y(0)
Q
;
ELEMENTS ;-- ;;Element Name;data piece in file 8971.1
;;CPU Time;1
;;Elapsed Time;7
;;M Commands;5
;;GLO References;6
;;DIO References;2
;;BIO References;3
;;Page Faults;4
;;Occurrences;8
KMPRUTL ;SFISC/KAK/RAK - Resource Usage Monitor Utilities ;2/29/00 10:29
+1 ;;1.0;CAPACITY MANAGEMENT - RUM;**1,2**;Dec 09, 1998
+2 ;
CONTINUE(KMPRMSSG,KMPRY) ;-- press return to continue
+1 ;---------------------------------------------------------------------
+2 ; KMPRMSSG. (optional) Message to display to user (if not defined then
+3 ; default message by ^DIR is used).
+4 ; KMPRY.... Return value: 0 - do not continue.
+5 ; 1 - continue.
+6 ; Access by reference.
+7 ;---------------------------------------------------------------------
+8 ;
+9 SET KMPRMSSG=$GET(KMPRMSSG)
SET KMPRY=0
+10 ;
+11 ; if not terminal continue without displaying message.
+12 IF $EXTRACT(IOST,1,2)'="C-"
SET KMPRY=1
QUIT
+13 ;
+14 NEW DIR,X,Y
+15 SET DIR(0)="EO"
+16 IF KMPRMSSG]""
SET DIR("A")=KMPRMSSG
+17 DO ^DIR
+18 SET KMPRY=+$GET(Y)
+19 ;
+20 QUIT
+21 ;
GRPHMSG ;-- graph message.
+1 NEW TXT
+2 SET TXT(1)="This option displays data in a graphical format. Please make"
+3 SET TXT(2)="note that this output is intended for comparison/trends only,"
+4 SET TXT(3)="and should not be used for detailed analysis."
+5 SET TXT(1,"F")="!?9"
SET TXT(2,"F")="!?9"
SET TXT(3,"F")="!?9"
+6 DO EN^DDIOL(.TXT)
+7 QUIT
+8 ;
HDR ; entry point to print header
+1 ; Input variables:
+2 ; KMPRPG = page number
+3 ; KMPRTL = title to print on header
+4 ; KMPRRP = reporting period date
+5 ; = print today's date (if NOT defined)
+6 DO PRESS
IF KMPROUT
QUIT
+7 IF '($EXTRACT(IOST,1,2)'="C-"&'KMPRPG)
WRITE @IOF
IF ($EXTRACT(IOST,1,2)="P-"&$DATA(IO("S"))&'KMPRPG)
SET (DX,DY)=0
XECUTE ^%ZOSF("XY")
+8 IF IOT="HFS"!($EXTRACT(IOST,1,2)="P-")
SET (IORVOFF,IORVON)=""
+9 SET KMPRPG=KMPRPG+1
WRITE !,?((IOM/2)-(($LENGTH(KMPRTL)+4)/2)),IORVON,"* ",KMPRTL," *",IORVOFF
+10 IF $DATA(KMPRRP)
WRITE !,?((IOM/2)-(($LENGTH(A1RP)+18)/2)),"Reporting Period: ",KMPRRP
+11 IF '$TEST
SET Y=DT
DO DD^%DT
WRITE !,?((IOM/2)-(($LENGTH(Y)+12)/2)),"Printed on: ",Y
+12 IF $EXTRACT(IOST,1,2)'="C-"
WRITE ?(IOM-9),"Page ",$JUSTIFY(KMPRPG,3)
WRITE !!
+13 QUIT
+14 ;
ID(KMPRIEN) ;-- display - called from ^DD(8971.1,0,"ID","W")
+1 ;-----------------------------------------------------------------------
+2 ; KMPRIEN... Ien for file #8971.1 (RESOURCE USAGE MONITOR).
+3 ;-----------------------------------------------------------------------
+4 IF '$GET(KMPRIEN)
QUIT
+5 IF '$DATA(^KMPR(8971.1,+KMPRIEN,0))
QUIT
+6 NEW DATA,TXT
+7 SET DATA=$GET(^KMPR(8971.1,+KMPRIEN,0))
+8 ; sent to cm national database.
+9 SET TXT(1)=$SELECT($PIECE(DATA,U,2):"sent",1:"not sent")
+10 SET TXT(1)=TXT(1)_$JUSTIFY(" ",10-$LENGTH(TXT(1)))
+11 ; node.
+12 SET TXT(1)=TXT(1)_$PIECE(DATA,U,3)
+13 SET TXT(1)=TXT(1)_$JUSTIFY(" ",22-$LENGTH(TXT(1)))
+14 ; option.
+15 IF $PIECE(DATA,U,4)]""
SET TXT(1)=TXT(1)_"option: "_$PIECE(DATA,U,4)
+16 ; rpc.
+17 IF '$TEST
IF $PIECE(DATA,U,7)]""
SET TXT(1)=TXT(1)_" rpc: "_$PIECE(DATA,U,7)
+18 SET TXT(1,"F")="?16"
+19 ; if protocol
+20 IF $PIECE(DATA,U,5)'=""
Begin DoDot:1
+21 ;_" (protocol)"
SET TXT(2)="protocol: "_$EXTRACT($PIECE(DATA,U,5),1,40)
+22 SET TXT(2,"F")="!?"_$SELECT($GET(DDSDIW):36,1:45)
End DoDot:1
+23 ; display TXT() array.
+24 DO EN^DDIOL(.TXT)
+25 QUIT
+26 ;
PRESS ;
+1 IF KMPRPG
IF $EXTRACT(IOST,1,2)="C-"
WRITE !,"Press RETURN to continue or '^' to exit: "
READ X:DTIME
IF X="^"!('$TEST)
SET KMPROUT=1
+2 QUIT
+3 ;
NODEARRY(KMPRARRY) ;-- put nodes into array.
+1 ;-----------------------------------------------------------------------
+2 ; KMPRARRY.. Array to contain nodes in format:
+3 ; KMPRARRY(NODENAME)=""
+4 ;-----------------------------------------------------------------------
+5 ;
+6 KILL @KMPRARRY
+7 ;
+8 NEW NODE
SET NODE=""
+9 FOR
SET NODE=$ORDER(^KMPR(8971.1,"ANODE",NODE))
IF NODE=""
QUIT
SET @KMPRARRY@(NODE)=""
+10 QUIT
+11 ;
RUMDATES(KMPRDATE) ;-- get RUM date ranges from file 8971.1
+1 ;---------------------------------------------------------------------
+2 ; KMPRDATE... Return value (access by reference) in format:
+3 ; StartDate^EndDate^ExtStartDate^ExtEndDate
+4 ; 2981101^2981104^Nov 1, 1998^Nov 4, 1998
+5 ;---------------------------------------------------------------------
+6 ;
+7 SET KMPRDATE=""
+8 NEW END,START
+9 ; determine start date from file 8971.1
+10 SET START=$ORDER(^KMPR(8971.1,"B",0))
+11 ; determine end date from file 8971.1
+12 SET END=$ORDER(^KMPR(8971.1,"B","A"),-1)
+13 DO DATERNG^KMPUTL1(.KMPRDATE,START,END)
+14 ;
+15 QUIT
+16 ;
VERSION() ;-- extrinsic - return current version.
+1 QUIT $PIECE($TEXT(+2^KMPRUTL),";",3)_"^"_$PIECE($TEXT(+2^KMPRUTL),";",5)
+2 ;
ZIS ; entry point to define IORVOFF and IORVON variables
+1 DO HOME^%ZIS
SET X="IORVOFF;IORVON"
DO ENDR^%ZISS
+2 IF IOT="HFS"
SET (IORVOFF,IORVON)=""
+3 QUIT
+4 ;
+5 ;
ELEARRY(KMPRARRY) ;-- set elements data into KMPRARRY.
+1 ;-----------------------------------------------------------------------
+2 ; KMPRARRY... Array to contain elements data.
+3 ; Format: ElementName^DataPiece
+4 ; KMPRARRY(1)=CPU Time^1
+5 ; KMPRARRY(2)=Elapsed Time^7
+6 ; KMPRARRY(...)=...
+7 ;-----------------------------------------------------------------------
+8 ;
+9 IF $GET(KMPRARRY)=""
QUIT
+10 ;
+11 NEW DATA,I
+12 FOR I=1:1
IF $PIECE($TEXT(ELEMENTS+I),";",3)=""
QUIT
Begin DoDot:1
+13 SET DATA=$TEXT(ELEMENTS+I)
+14 SET @KMPRARRY@(I)=$PIECE(DATA,";",3)_"^"_$PIECE(DATA,";",4)
End DoDot:1
+15 QUIT
+16 ;
ELEMENT(KMPUVAR) ;-- select RUM data element.
+1 ; Output Variable:
+2 ; KMPUVAR = Number of Data Piece
+3 ; = '^' if DTOUT or DUOUT
+4 ; KMPUVAR(0) = Set of Code's Verbiage
+5 ;
+6 NEW DIR,DTOUT,DUOUT,I,X,Y
+7 SET KMPUVAR=""
+8 SET DIR(0)="SXO^"
+9 FOR I=1:1
IF $PIECE($TEXT(ELEMENTS+I),";",3)=""
QUIT
Begin DoDot:1
+10 SET DIR(0)=DIR(0)_I_":"_$PIECE($TEXT(ELEMENTS+I),";",3)_";"
End DoDot:1
+11 SET DIR("A")="Enter Key Data Element for Searching RUM Data"
+12 DO ^DIR
IF $DATA(DTOUT)!$DATA(DUOUT)!(Y="")
SET KMPUVAR="^"
SET KMPUVAR(0)=""
QUIT
+13 SET KMPUVAR=$TRANSLATE(Y,"12345678^","17562348^")
SET KMPUVAR(0)=Y(0)
+14 QUIT
+15 ;
ELEMENTS ;-- ;;Element Name;data piece in file 8971.1
+1 ;;CPU Time;1
+2 ;;Elapsed Time;7
+3 ;;M Commands;5
+4 ;;GLO References;6
+5 ;;DIO References;2
+6 ;;BIO References;3
+7 ;;Page Faults;4
+8 ;;Occurrences;8