KMPDU6 ;OAK/RAK - CM Tools Utilities ;10/12/12 15:15
;;3.0;KMPD;;Jan 22, 2009;Build 42
;
RUMENV(KMPDRES) ;-rpc run environment
;--------------------------------------------------------
; KMPDRES... result return data in format:
; KMPDRES(0)=ErrorNumber^ErrorText
; (see ENV^KMPRUTL1 for specifics)
;--------------------------------------------------------
K KMPDRES
N ERROR
D ENVCHECK^KMPRUTL1(.ERROR,1)
S KMPDRES(0)=ERROR
;
Q
;
RUMSS(KMPDRES,KMPDSS) ;-rpc rum start/stop
;--------------------------------------------------------
; KMPDRES... result return data
; KMPDSS.... 0 - stop
; 1 - start
;--------------------------------------------------------
K KMPDRES
S KMPDSS=+$G(KMPDSS)
N DA,DIE,ERR,ERROR,DR,FDA,I,LINE,X,Y
; if start
I KMPDSS=1 D
.S FDA($J,8989.3,"1,",300)="Y"
.D FILE^DIE("","FDA($J)","ERROR")
.; if error process and quit
.I $D(ERROR) D Q
..; put error message into local array
..D MSG^DIALOG("AEHW",.ERR,60,10,"ERROR")
..; put error message into kmpdres array
..S (LINE,I)=0
..F S I=$O(ERR(I)) Q:'I D
...I LINE=0 S KMPDRES(LINE)="["_ERR(I) S LINE=LINE+1 Q
...S KMPDRES(LINE)=ERR(I),LINE=LINE+1
..; put close bracket at end of text
..S KMPDRES(LINE-1)=KMPDRES(LINE-1)_"]"
.;
.S KMPDRES(0)="Resource Usage Monitor (RUM) has been started."
;
; if stop
I 'KMPDSS D
.S FDA($J,8989.3,"1,",300)="N"
.D FILE^DIE("","FDA($J)","ERROR")
.; if error process and quit
.I $D(ERROR) D Q
..; put error message into local array
..D MSG^DIALOG("AEHW",.ERR,60,10,"ERROR")
..; put error message into kmpdres array
..S (LINE,I)=0
..F S I=$O(ERR(I)) Q:'I D
...I LINE=0 S KMPDRES(LINE)="["_ERR(I) S LINE=LINE+1 Q
...S KMPDRES(LINE)=ERR(I),LINE=LINE+1
..; put close bracket at end of text
..S KMPDRES(LINE-1)=KMPDRES(LINE-1)_"]"
.;
.S KMPDRES(0)="Resource Usage Monitor (RUM) has been stopped."
;
I '$D(KMPDRES(0)) S KMPDRES(0)="[Unable to "_$S(KMPDSS:"start",1:"stop")_" RUM]"
;
Q
;
STATUS(KMPDRES,KMPDAPP,KMPDGBL) ;-rpc cp package status
;--------------------------------------------------------
; KMPDRES... result return data
; KMPDAPP... cm application
; H - hl7
; R - rum
; S - sagg
; T - timing
; KMPDGLO... global reference containing data
;--------------------------------------------------------
;
;
K KMPDRES
I $G(KMPDAPP)="" S @KMPDGBL@(0)="[Type of Application not defined]" Q
I $L(KMPDAPP)>1 S @KMPDGBL@(0)="[Incorrect Application identifier format]" Q
I "HRST"'[KMPDAPP S @KMPDGBL@(0)="[Incorrect Application identifier]" Q
;I KMPDGBL="" S @KMPDGBL@(0)="[Global for storage is not defined]" Q
I $G(KMPDGBL)="" S @KMPDGBL@(0)="[Global for storage is not defined]" Q
;
N DATA,I,KMPDNMSP,ROUTINE,VALMAR,X,Z
;
; kill global with check for ^tmp or ^utility.
D KILL^KMPDU(.DATA,KMPDGBL)
; if error.
I $E(DATA)="[" S @KMPDGBL@(0)=DATA Q
;
S KMPDNMSP=KMPDAPP
S ROUTINE="KMPDSS"_$S(KMPDAPP="H"!(KMPDAPP="T"):"D",1:KMPDAPP)
S X=ROUTINE X ^%ZOSF("TEST") I '$T D Q
.S @KMPDGBL@(0)="[Routine "_X_" could not be found]"
;
S ROUTINE="FORMAT^"_X_"(.Z)"
S VALMAR=$NA(^TMP("KMPDU6",$J))
;
D @ROUTINE
;
I '$D(@VALMAR) S KMPDRES(0)="[No data to report]" K @VALMAR Q
;
; zero node is application status: started/stopped
I KMPDAPP="H" S @KMPDGBL@(0)="0"
I KMPDAPP="R" S @KMPDGBL@(0)=$G(^%ZTSCH("LOGRSRC"))
I KMPDAPP="S" S @KMPDGBL@(0)=$S($D(^XTMP("KMPS","START")):1,1:0)
I KMPDAPP="T" S @KMPDGBL@(0)=$G(^KMPTMP("KMPD-CPRS"))
F I=0:0 S I=$O(@VALMAR@(I)) Q:'I S @KMPDGBL@(I)=@VALMAR@(I,0)
;
K @VALMAR
;
S KMPDRES=$NA(@KMPDGBL)
S:'$D(@KMPDGBL) KMPDRES="<No Data To Report>"
;
Q
;
USRPARAM(KMPDY,KMPDUZ,KMPDTY,KMPDOP) ;-- rpc - user parameters
;-------------------------------------------------------------------
; KMPDY... return results
; KMPDUZ.. user duz
; KMPDTY.. type: 1 - get user parameter info
; 2 - set user parameter info
; KMPDOP.. option array in format:
; Piece 1: option name
; Piece 2: 1 - do not display option
; 2 - display option
; example: KMPDOP(1)="ErrorLog1^1"
;-------------------------------------------------------------------
;
K KMPDY
;
I '$G(KMPDUZ) S KMPDY(0)="[User 'DUZ' not defined]" Q
S KMPDTY=+$G(KMPDTY)
I KMPDTY<1!(KMPDTY>2) S KMPDY(0)="[Type parameter out of bounds]" Q
;
; get parameter data
I KMPDTY=1 D
.S KMPDY(0)="ErrorLog1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ERROR LIST",,"Q")
.S KMPDY(1)="GlobalList1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION GLOBAL LIST",,"Q")
.S KMPDY(2)="RoutineSearch1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ROUTINE SEARCH",,"Q")
.S KMPDY(3)="Lookups1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION LOOKUPS",,"Q")
.S KMPDY(4)="CodeStats1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE STATS",,"Q")
.S KMPDY(5)="CodeEvaluator2^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE EVALUATOR",,"Q")
.S KMPDY(6)="TimingMonitor1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TIMING MONITOR",,"E")
.S KMPDY(7)="EnvironmentCheck1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON CHECK",,"Q")
.S KMPDY(8)="CMToolsParameters1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TOOLS PARAMS",,"Q")
.S KMPDY(9)="EnvironmentSelect^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON SELECT",,"Q")
.S KMPDY(10)="TimingReports1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION RPT",,"Q")
;
; set parameter data
I KMPDTY=2 D
.Q:'$D(KMPDOP)
.N I,OPT S I="",KMPDY(0)="complete"
.F S I=$O(KMPDOP(I)) Q:I="" S OPT=KMPDOP(I) I OPT]"" D
..I $P(OPT,U)="ErrorLog1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ERROR LIST",1,$P(OPT,U,2))
..I $P(OPT,U)="GlobalList1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION GLOBAL LIST",1,$P(OPT,U,2))
..I $P(OPT,U)="RoutineSearch1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ROUTINE SEARCH",1,$P(OPT,U,2))
..I $P(OPT,U)="Lookups1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION LOOKUPS",1,$P(OPT,U,2))
..I $P(OPT,U)="CodeStats1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE STATS",1,$P(OPT,U,2))
..I $P(OPT,U)="CodeEvaluator2" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE EVALUATOR",1,$P(OPT,U,2))
..I $P(OPT,U)="TimingMonitor1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TIMING MONITOR",1,$P(OPT,U,2))
..I $P(OPT,U)="EnvironmentCheck1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON CHECK",1,$P(OPT,U,2))
..I $P(OPT,U)="CMToolsParameters1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TOOLS PARAMS",1,$P(OPT,U,2))
..I $P(OPT,U)="EnvironmentSelect" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON SELECT",1,$P(OPT,U,2))
..I $P(OPT,U)="TimingReports1" D EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION RPT",1,$P(OPT,U,2))
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDU6 6879 printed Nov 22, 2024@16:51:15 Page 2
KMPDU6 ;OAK/RAK - CM Tools Utilities ;10/12/12 15:15
+1 ;;3.0;KMPD;;Jan 22, 2009;Build 42
+2 ;
RUMENV(KMPDRES) ;-rpc run environment
+1 ;--------------------------------------------------------
+2 ; KMPDRES... result return data in format:
+3 ; KMPDRES(0)=ErrorNumber^ErrorText
+4 ; (see ENV^KMPRUTL1 for specifics)
+5 ;--------------------------------------------------------
+6 KILL KMPDRES
+7 NEW ERROR
+8 DO ENVCHECK^KMPRUTL1(.ERROR,1)
+9 SET KMPDRES(0)=ERROR
+10 ;
+11 QUIT
+12 ;
RUMSS(KMPDRES,KMPDSS) ;-rpc rum start/stop
+1 ;--------------------------------------------------------
+2 ; KMPDRES... result return data
+3 ; KMPDSS.... 0 - stop
+4 ; 1 - start
+5 ;--------------------------------------------------------
+6 KILL KMPDRES
+7 SET KMPDSS=+$GET(KMPDSS)
+8 NEW DA,DIE,ERR,ERROR,DR,FDA,I,LINE,X,Y
+9 ; if start
+10 IF KMPDSS=1
Begin DoDot:1
+11 SET FDA($JOB,8989.3,"1,",300)="Y"
+12 DO FILE^DIE("","FDA($J)","ERROR")
+13 ; if error process and quit
+14 IF $DATA(ERROR)
Begin DoDot:2
+15 ; put error message into local array
+16 DO MSG^DIALOG("AEHW",.ERR,60,10,"ERROR")
+17 ; put error message into kmpdres array
+18 SET (LINE,I)=0
+19 FOR
SET I=$ORDER(ERR(I))
if 'I
QUIT
Begin DoDot:3
+20 IF LINE=0
SET KMPDRES(LINE)="["_ERR(I)
SET LINE=LINE+1
QUIT
+21 SET KMPDRES(LINE)=ERR(I)
SET LINE=LINE+1
End DoDot:3
+22 ; put close bracket at end of text
+23 SET KMPDRES(LINE-1)=KMPDRES(LINE-1)_"]"
End DoDot:2
QUIT
+24 ;
+25 SET KMPDRES(0)="Resource Usage Monitor (RUM) has been started."
End DoDot:1
+26 ;
+27 ; if stop
+28 IF 'KMPDSS
Begin DoDot:1
+29 SET FDA($JOB,8989.3,"1,",300)="N"
+30 DO FILE^DIE("","FDA($J)","ERROR")
+31 ; if error process and quit
+32 IF $DATA(ERROR)
Begin DoDot:2
+33 ; put error message into local array
+34 DO MSG^DIALOG("AEHW",.ERR,60,10,"ERROR")
+35 ; put error message into kmpdres array
+36 SET (LINE,I)=0
+37 FOR
SET I=$ORDER(ERR(I))
if 'I
QUIT
Begin DoDot:3
+38 IF LINE=0
SET KMPDRES(LINE)="["_ERR(I)
SET LINE=LINE+1
QUIT
+39 SET KMPDRES(LINE)=ERR(I)
SET LINE=LINE+1
End DoDot:3
+40 ; put close bracket at end of text
+41 SET KMPDRES(LINE-1)=KMPDRES(LINE-1)_"]"
End DoDot:2
QUIT
+42 ;
+43 SET KMPDRES(0)="Resource Usage Monitor (RUM) has been stopped."
End DoDot:1
+44 ;
+45 IF '$DATA(KMPDRES(0))
SET KMPDRES(0)="[Unable to "_$SELECT(KMPDSS:"start",1:"stop")_" RUM]"
+46 ;
+47 QUIT
+48 ;
STATUS(KMPDRES,KMPDAPP,KMPDGBL) ;-rpc cp package status
+1 ;--------------------------------------------------------
+2 ; KMPDRES... result return data
+3 ; KMPDAPP... cm application
+4 ; H - hl7
+5 ; R - rum
+6 ; S - sagg
+7 ; T - timing
+8 ; KMPDGLO... global reference containing data
+9 ;--------------------------------------------------------
+10 ;
+11 ;
+12 KILL KMPDRES
+13 IF $GET(KMPDAPP)=""
SET @KMPDGBL@(0)="[Type of Application not defined]"
QUIT
+14 IF $LENGTH(KMPDAPP)>1
SET @KMPDGBL@(0)="[Incorrect Application identifier format]"
QUIT
+15 IF "HRST"'[KMPDAPP
SET @KMPDGBL@(0)="[Incorrect Application identifier]"
QUIT
+16 ;I KMPDGBL="" S @KMPDGBL@(0)="[Global for storage is not defined]" Q
+17 IF $GET(KMPDGBL)=""
SET @KMPDGBL@(0)="[Global for storage is not defined]"
QUIT
+18 ;
+19 NEW DATA,I,KMPDNMSP,ROUTINE,VALMAR,X,Z
+20 ;
+21 ; kill global with check for ^tmp or ^utility.
+22 DO KILL^KMPDU(.DATA,KMPDGBL)
+23 ; if error.
+24 IF $EXTRACT(DATA)="["
SET @KMPDGBL@(0)=DATA
QUIT
+25 ;
+26 SET KMPDNMSP=KMPDAPP
+27 SET ROUTINE="KMPDSS"_$SELECT(KMPDAPP="H"!(KMPDAPP="T"):"D",1:KMPDAPP)
+28 SET X=ROUTINE
XECUTE ^%ZOSF("TEST")
IF '$TEST
Begin DoDot:1
+29 SET @KMPDGBL@(0)="[Routine "_X_" could not be found]"
End DoDot:1
QUIT
+30 ;
+31 SET ROUTINE="FORMAT^"_X_"(.Z)"
+32 SET VALMAR=$NAME(^TMP("KMPDU6",$JOB))
+33 ;
+34 DO @ROUTINE
+35 ;
+36 IF '$DATA(@VALMAR)
SET KMPDRES(0)="[No data to report]"
KILL @VALMAR
QUIT
+37 ;
+38 ; zero node is application status: started/stopped
+39 IF KMPDAPP="H"
SET @KMPDGBL@(0)="0"
+40 IF KMPDAPP="R"
SET @KMPDGBL@(0)=$GET(^%ZTSCH("LOGRSRC"))
+41 IF KMPDAPP="S"
SET @KMPDGBL@(0)=$SELECT($DATA(^XTMP("KMPS","START")):1,1:0)
+42 IF KMPDAPP="T"
SET @KMPDGBL@(0)=$GET(^KMPTMP("KMPD-CPRS"))
+43 FOR I=0:0
SET I=$ORDER(@VALMAR@(I))
if 'I
QUIT
SET @KMPDGBL@(I)=@VALMAR@(I,0)
+44 ;
+45 KILL @VALMAR
+46 ;
+47 SET KMPDRES=$NAME(@KMPDGBL)
+48 if '$DATA(@KMPDGBL)
SET KMPDRES="<No Data To Report>"
+49 ;
+50 QUIT
+51 ;
USRPARAM(KMPDY,KMPDUZ,KMPDTY,KMPDOP) ;-- rpc - user parameters
+1 ;-------------------------------------------------------------------
+2 ; KMPDY... return results
+3 ; KMPDUZ.. user duz
+4 ; KMPDTY.. type: 1 - get user parameter info
+5 ; 2 - set user parameter info
+6 ; KMPDOP.. option array in format:
+7 ; Piece 1: option name
+8 ; Piece 2: 1 - do not display option
+9 ; 2 - display option
+10 ; example: KMPDOP(1)="ErrorLog1^1"
+11 ;-------------------------------------------------------------------
+12 ;
+13 KILL KMPDY
+14 ;
+15 IF '$GET(KMPDUZ)
SET KMPDY(0)="[User 'DUZ' not defined]"
QUIT
+16 SET KMPDTY=+$GET(KMPDTY)
+17 IF KMPDTY<1!(KMPDTY>2)
SET KMPDY(0)="[Type parameter out of bounds]"
QUIT
+18 ;
+19 ; get parameter data
+20 IF KMPDTY=1
Begin DoDot:1
+21 SET KMPDY(0)="ErrorLog1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ERROR LIST",,"Q")
+22 SET KMPDY(1)="GlobalList1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION GLOBAL LIST",,"Q")
+23 SET KMPDY(2)="RoutineSearch1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ROUTINE SEARCH",,"Q")
+24 SET KMPDY(3)="Lookups1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION LOOKUPS",,"Q")
+25 SET KMPDY(4)="CodeStats1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE STATS",,"Q")
+26 SET KMPDY(5)="CodeEvaluator2^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE EVALUATOR",,"Q")
+27 SET KMPDY(6)="TimingMonitor1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TIMING MONITOR",,"E")
+28 SET KMPDY(7)="EnvironmentCheck1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON CHECK",,"Q")
+29 SET KMPDY(8)="CMToolsParameters1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TOOLS PARAMS",,"Q")
+30 SET KMPDY(9)="EnvironmentSelect^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON SELECT",,"Q")
+31 SET KMPDY(10)="TimingReports1^"_$$GET^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION RPT",,"Q")
End DoDot:1
+32 ;
+33 ; set parameter data
+34 IF KMPDTY=2
Begin DoDot:1
+35 if '$DATA(KMPDOP)
QUIT
+36 NEW I,OPT
SET I=""
SET KMPDY(0)="complete"
+37 FOR
SET I=$ORDER(KMPDOP(I))
if I=""
QUIT
SET OPT=KMPDOP(I)
IF OPT]""
Begin DoDot:2
+38 IF $PIECE(OPT,U)="ErrorLog1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ERROR LIST",1,$PIECE(OPT,U,2))
+39 IF $PIECE(OPT,U)="GlobalList1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION GLOBAL LIST",1,$PIECE(OPT,U,2))
+40 IF $PIECE(OPT,U)="RoutineSearch1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ROUTINE SEARCH",1,$PIECE(OPT,U,2))
+41 IF $PIECE(OPT,U)="Lookups1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION LOOKUPS",1,$PIECE(OPT,U,2))
+42 IF $PIECE(OPT,U)="CodeStats1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE STATS",1,$PIECE(OPT,U,2))
+43 IF $PIECE(OPT,U)="CodeEvaluator2"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION CODE EVALUATOR",1,$PIECE(OPT,U,2))
+44 IF $PIECE(OPT,U)="TimingMonitor1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TIMING MONITOR",1,$PIECE(OPT,U,2))
+45 IF $PIECE(OPT,U)="EnvironmentCheck1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON CHECK",1,$PIECE(OPT,U,2))
+46 IF $PIECE(OPT,U)="CMToolsParameters1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION TOOLS PARAMS",1,$PIECE(OPT,U,2))
+47 IF $PIECE(OPT,U)="EnvironmentSelect"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION ENVIRON SELECT",1,$PIECE(OPT,U,2))
+48 IF $PIECE(OPT,U)="TimingReports1"
DO EN^XPAR("USR.`"_KMPDUZ,"KMPD GUI OPTION RPT",1,$PIECE(OPT,U,2))
End DoDot:2
End DoDot:1
+49 ;
+50 QUIT