KMPVCCFG ;SP/JML - VSM configuration functions -- APIs for data access ;11/1/2023
;;4.0;CAPACITY MANAGEMENT;**1,2,4**;3/1/2018;Build 36
;
; Integration Agreements
; Reference to GETENV^%ZOSV supported by ICR #10097
; Reference to $$SITE^VASITE supported by ICR #10112
;
CFGARR(KMPVMKEY,KMPVCFG,KMPVFLAG) ; Return configuration by monitor in array
; to be deprecated
K KMPVCFG S U="^"
N KMPVIEN,KMPV0,KMPV1,KMPV2,KMPV3,KMPV4
I $D(^KMPV(8969,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969,"B",KMPVMKEY,""))
Q:$G(KMPVIEN)=""
S KMPV0=$G(^KMPV(8969,KMPVIEN,0)),KMPV1=$G(^KMPV(8969,KMPVIEN,1))
S KMPV2=$G(^KMPV(8969,KMPVIEN,2)),KMPV3=$G(^KMPV(8969,KMPVIEN,3)),KMPV4=$G(^KMPV(8969,KMPVIEN,4))
S KMPVCFG("ONOFF")=$$GETVAL(KMPVMKEY,"ONOFF",8969,$G(KMPVFLAG)),KMPVCFG("VERSION")=$P(KMPV0,U,4)
S KMPVCFG("VERSION INSTALL DATE")=$P(KMPV0,U,5),KMPVCFG("DAYS TO KEEP DATA")=$P(KMPV1,U)
S KMPVCFG("COLLECTION INTERVAL")=$P(KMPV1,U,2),KMPVCFG("CACHE DAILY TASK")=$P(KMPV1,U,3)
S KMPVCFG("ALLOW TEST SYSTEM")=$$GETVAL(KMPVMKEY,"ALLOW TEST SYSTEM",8969,$G(KMPVFLAG)),KMPVCFG("HTTP REQUEST MAX LENGTH")=$P(KMPV1,U,5)
S KMPVCFG("MONITOR START DELAY")=$P(KMPV1,U,6),KMPVCFG("TASKMAN OPTION")=$P(KMPV1,U,7)
S KMPVCFG("ENCRYPT")=$P(KMPV1,U,9)
S KMPVCFG("LAST START TIME")=$P(KMPV2,U),KMPVCFG("LAST STOP TIME")=$P(KMPV2,U,2)
S KMPVCFG("LAST RUN TIME")=$P(KMPV2,U,3),KMPVCFG("NATIONAL DATA EMAIL ADDRESS")=$P(KMPV3,U)
S KMPVCFG("NATIONAL SUPPORT EMAIL ADDRESS")=$P(KMPV3,U,2)
S KMPVCFG("VSM CFG EMAIL ADDRESS")=$P(KMPV3,U,3),KMPVCFG("LOCAL SUPPORT EMAIL ADDRESS")=$P(KMPV3,U,4)
S KMPVCFG("NATIONAL IP ADDRESS")=$P(KMPV4,U,1),KMPVCFG("NATIONAL FQDN")=$P(KMPV4,U,2)
S KMPVCFG("NATIONAL PORT")=$P(KMPV4,U,3),KMPVCFG("APIKEY")=$P(KMPV4,U,4)
Q
;
GETDEF(KMPVMKEY,KMPVDEF,KMPVFLAG) ; Return default configuration in array
; to be deprecated - fields have changed
K KMPVDEF S U="^"
N KMPVIEN,KMPV0,KMPV1
I $D(^KMPV(8969.02,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969.02,"B",KMPVMKEY,""))
Q:$G(KMPVIEN)=""
S KMPV0=$G(^KMPV(8969.02,KMPVIEN,0)),KMPV1=$G(^KMPV(8969.02,KMPVIEN,1))
S KMPV2=$G(^KMPV(8969.02,KMPVIEN,2))
W KMPV0
S KMPVDEF("DAYS TO KEEP DATA")=$P(KMPV0,U,2),KMPVDEF("COLLECTION INTERVAL")=$P(KMPV0,U,3)
S KMPVDEF("CACHE DAILY TASK")=$P(KMPV0,U,4),KMPVDEF("ALLOW TEST SYSTEM")=$P(KMPV0,U,5)
S KMPVDEF("TASKMAN SCHEDULE FREQUENCY")=$P(KMPV0,U,6),KMPVDEF("TASKMAN SCHEDULE START")=$P(KMPV0,U,7)
S KMPVDEF("TASKMAN OPTION")=$P(KMPV0,U,8),KMPVDEF("START PERFMON")=$P(KMPV0,U,9)
S KMPVDEF("ENCRYPT")=$P(KMPV0,U,10),KMPVDEF("NATIONAL DATA EMAIL ADDRESS")=$P(KMPV1,U)
S KMPVDEF("NATIONAL SUPPORT EMAIL ADDRESS")=$P(KMPV1,U,2),KMPVDEF("VSM CFG EMAIL ADDRESS")=$P(KMPV1,U,3)
S KMPVDEF("NATIONAL IP ADDRESS")=$P(KMPV2,U,1),KMPVDEF("NATIONAL FQDN")=$P(KMPV2,U,2)
S KMPVDEF("NATIONAL PORT")=$P(KMPV2,U,3),KMPVDEF("APIKEY")=$P(KMPV2,U,4)
Q
;
CFGSTR(KMPVMKEY,KMPVFLAG) ; Return configuration in "^" delimited string
S U="^"
N KMPVCFG,KMPVIEN,KMPRT,KMPV0,KMPV1,KMPV2,KMPV3
I $D(^KMPV(8969,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969,"B",KMPVMKEY,""))
Q:$G(KMPVIEN)="" ""
S KMPVCFG=""
S KMPV0=$G(^KMPV(8969,KMPVIEN,0)),KMPV1=$G(^KMPV(8969,KMPVIEN,1))
S KMPRT=$S($$GETVAL^KMPVCCFG(KMPVMKEY,"VERSION",8969)>2:1,1:0)
; MONITOR KEY^ONOFF^VERSION^VERSION INSTALL DATE^DAYS TO KEEP DATA^COLLECTION INTERVAL^HTTP REQUEST MAX LENGTH^MONITOR START DELAY^ALLOW TEST
; ^CACHE DAILY TASK^TASKMAN TASK^REALTIME^START PERFMON^ENCRYPT
S KMPVCFG=KMPVMKEY_U_$$GETVAL(KMPVMKEY,"ONOFF",8969,$G(KMPVFLAG))_U_$P(KMPV0,U,4)_U_$P(KMPV0,U,5)_U_$P(KMPV1,U,1)_U_$P(KMPV1,U,2)_U
S KMPVCFG=KMPVCFG_$P(KMPV1,U,5)_U_$P(KMPV1,U,6)_U_$$GETVAL(KMPVMKEY,"ALLOW TEST SYSTEM",8969,$G(KMPVFLAG))_U
S KMPVCFG=KMPVCFG_$P(KMPV1,U,3)_U_$P(KMPV1,U,7)_U_KMPRT_U_$P(KMPV1,U,8)_U_$P(KMPV1,U,9)
Q KMPVCFG
;
GETVAL(KMPVMKEY,KMPVFLD,KMPVFILE,KMPVFLAG) ; retrieve value from VSM CONFIGURATION or VSM MONITOR DEFAULTS files
N KMPVIEN
I KMPVFILE=8969,$D(^KMPV(8969,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969,"B",KMPVMKEY,""))
I KMPVFILE=8969.02,$D(^KMPV(8969.02,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969.02,"B",KMPVMKEY,""))
Q:$G(KMPVIEN)="" ""
Q $$GET1^DIQ(KMPVFILE,KMPVIEN,KMPVFLD,$G(KMPVFLAG))
;
; SETTER FUNCTIONS
;
SETONE(KMPVMKEY,KMPVFNAM,KMPVNVAL,KMPVERR) ; set a value into the VSM CONFIGURATION file
K KMPVERR,KMPVEARR
N FDA,KMPVIEN,KMPVEARR,KMPVOVAL,KMPVSTAT,KMPVUP
S KMPVSTAT=0,KMPVLOG=+$G(KMPVLOG)
S KMPVOVAL=$$GETVAL(KMPVMKEY,KMPVFNAM,8969)
I KMPVOVAL=KMPVNVAL Q KMPVSTAT
I $D(^KMPV(8969,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969,"B",KMPVMKEY,""))
I $G(KMPVIEN)="" S KMPVSTAT="1^MONITOR TYPE NOT CONFIGURED" Q KMPVSTAT
S KMPVFNUM=$$FLDNUM^DILFD(8969,KMPVFNAM)
I +KMPVFNUM=0 S KMPVSTAT="1^FIELD NAME '"_KMPVFNAM_"' DOES NOT EXIST" Q KMPVSTAT
S FDA($J,8969,KMPVIEN_",",KMPVFNUM)=KMPVNVAL
D FILE^DIE("ET","FDA($J)","KMPVEARR")
I $D(KMPVEARR) D Q KMPVSTAT
.M KMPVERR=KMPVEARR
.S KMPVSTAT="1^FILING ERROR"
Q KMPVSTAT
;
SETVALS(KMPVMKEY,KMPVFVAL,KMPVERR,KMPVLOG) ; set multiple values into the VSM CONFIGURATION file
; KMPVFVAL(FieldName)=FieldValue, KMPVERR: Output array if errors
K KMPVERR,KMPVEARR
N FDA,KMPVDATA,KMPVIEN,KMVEARR,KMPVFNAM,KMPVFNUM,KMPVSTAT
S KMPVSTAT=0,KMPVLOG=+$G(KMPVLOG)
I $D(^KMPV(8969,"B",KMPVMKEY)) S KMPVIEN=$O(^KMPV(8969,"B",KMPVMKEY,""))
I $G(KMPVIEN)="" S KMPVSTAT="1^MONITOR TYPE NOT CONFIGURED" Q KMPVSTAT
; get field numbers and set FDA array
S KMPVFNAM=""
F S KMPVFNAM=$O(KMPVFVAL(KMPVFNAM)) Q:KMPVFNAM="" D
.S KMPVFNUM=$$FLDNUM^DILFD(8969,KMPVFNAM)
.I KMPVFNUM>0 S FDA($J,8969,KMPVIEN_",",KMPVFNUM)=KMPVFVAL(KMPVFNAM)
.E S KMPVEARR(KMPVFNAM)=""
; If field name does not exist set error array and quit
I $D(KMPVEARR) D Q KMPVSTAT
.S KMPVSTAT="1^FIELD NAME DOES NOT EXIST"
.M KMPVERR=KMPVEARR
D FILE^DIE("ET","FDA($J)","KMPVEARR")
; If filing errors set error array
I $D(KMPVEARR) D Q KMPVSTAT
.M KMPVERR=KMPVEARR
.S KMPVSTAT="1^FILING ERROR"
Q KMPVSTAT
;
; OTHER FUNCTIONS
;
RESTCFG(KMPVMKEY,KMPUSER,KMPVERR) ; Restore default configuration to VSM CONFIGURATION file
N KMPVSTAT
D GETDEF(KMPVMKEY,.KMPVDEF)
S KMPVSTAT=$$SETVALS(KMPVMKEY,.KMPVDEF,.KMPVERR)
D CFGMSG^KMPUTLW($G(KMPUSER))
Q KMPVSTAT
;
STRSTP(KMPVMKEY,KMPVSTIME) ; Record run time values
Q:KMPVMKEY=""
Q:KMPVSTIME=""
N %,%H,X,KMPVETFM,KMPVFVAL,KMPVSTAT,KMPVSTFM,KMPVTDIFF
S %H=KMPVSTIME D YMD^%DTC S KMPVSTFM=X_%
S %H=$H D YMD^%DTC S KMPVETFM=X_%
S KMPVTDIFF=$$FMDIFF^XLFDT(KMPVETFM,KMPVSTFM,2)
S KMPVFVAL("LAST START TIME")=KMPVSTFM
S KMPVFVAL("LAST STOP TIME")=KMPVETFM
S KMPVFVAL("LAST RUN TIME")=KMPVTDIFF
S KMPVSTAT=$$SETVALS(KMPVMKEY,.KMPVFVAL,.KMPVEARR,1)
Q
;
SYSCFG() ; Return system configuration values
Q $$VERSION^%ZOSV(1)_"^"_$$OS^%ZOSV_"^"_$$VERSION^%ZOSV(0)_"^"_$$PROD() ; IA 10097
;
MONSTAT(KMPVTEXT) ; Return status information for all configured monitors
K KMPVTEXT
N KMPCNT,KMPI,KMPVBGD,KMPVCDAYS,KMPVCOMP,KMPVDDAYS,KMPVDLY,KMPVENT,KMPVI,KMPVML,KMPVMKEY,KMPVOPT,KMPVTASK,Y
;
D MONLIST^KMPVCBG(.KMPVML)
S KMPVMKEY=""
F S KMPVMKEY=$O(KMPVML(KMPVMKEY)) Q:KMPVMKEY="" D
.S KMPVTEXT(KMPVMKEY)=KMPVML(KMPVMKEY)
.D CFGARR(KMPVMKEY,.KMPVCFG)
.S KMPVTEXT(KMPVMKEY,"ONOFF")=KMPVCFG("ONOFF")
.S KMPI="",KMPCNT=0
.F S KMPI=$O(^KMPTMP("KMPV",KMPVMKEY,"RETRY",KMPI)) Q:KMPI="" S KMPCNT=KMPCNT+1
.S KMPVTEXT(KMPVMKEY,"RETRY")=KMPCNT
.S KMPVTEXT(KMPVMKEY,"VERSION")=$$GETVAL^KMPVCCFG(KMPVMKEY,"VERSION",8969)
Q
;
USERNAME(KMPVDUZ) ; Return users name from DUZ
N KMPVNAME,KMPVOUT
; IA 10060 for lookup into NEW PERSON file
I +KMPVDUZ'>0 Q ""
D FIND^DIC(200,"","","A",KMPVDUZ,"","","","","KMPVOUT")
S KMPVNAME=$G(KMPVOUT("DILIST",1,1))
Q KMPVNAME
;
PROD() ; Return "prod" if production, "test" otherwise
N KMPVPROD
S KMPVPROD=$$PROD^XUPROD() ; IA 4440
S KMPVPROD=$S(KMPVPROD=1:"prod",1:"test")
Q KMPVPROD
;
SITEINFO() ;
N KMPVDOM,KMPVSINF,KMPVPROD,KMPVSCD,KMPVSITE
S KMPVPROD=$$PROD^KMPVCCFG()
S KMPVDOM=$P($$NETNAME^XMXUTIL(.5),"@",2) ;IA 2734
D NOW^%DTC
S KMPVSITE=$$SITE^VASITE($P(%,".")) ;IA 10112
D GETENV^%ZOSV S KMPVSCD=$P(Y,U,1) ; IA 10097
S KMPVSINF=$P(KMPVSITE,U,2)_"^"_$P(KMPVSITE,U,3)_"^"_KMPVDOM_"^"_KMPVPROD_"^"_KMPVSCD
Q KMPVSINF
;
SLOT(KMPTIME,KMPSINT,KMPTFORM) ;
; NOTE: code in %ZOSVKR similar. All other VSM monitors call here.
N X,%T,%H,KMPSSEC,KMPSEC,X,KMPSLOT,KMPSTIME
S KMPSSEC=KMPSINT*60
I KMPTFORM="HOROLOG" D
.S KMPSEC=$P(KMPTIME,",",2)
I KMPTFORM="FILEMAN" D
.S X=KMPTIME D H^%DTC S KMPSEC=%T
.I KMPSEC>86399 S KMPSEC=86399
S KMPSLOT=KMPSEC\KMPSSEC
S KMPSTIME=KMPSLOT*KMPSSEC
Q KMPSTIME
;
ISBENODE(KMPNODE) ;
N RET,KMPINST,KMPNTYP
S RET=0
Q:$P(KMPNODE,":",2)="" -1
S KMPINST=$P(KMPNODE,":",2)
I $E(KMPINST,7,9)="SVR" S RET=1
Q RET
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPVCCFG 8836 printed Dec 13, 2024@01:42 Page 2
KMPVCCFG ;SP/JML - VSM configuration functions -- APIs for data access ;11/1/2023
+1 ;;4.0;CAPACITY MANAGEMENT;**1,2,4**;3/1/2018;Build 36
+2 ;
+3 ; Integration Agreements
+4 ; Reference to GETENV^%ZOSV supported by ICR #10097
+5 ; Reference to $$SITE^VASITE supported by ICR #10112
+6 ;
CFGARR(KMPVMKEY,KMPVCFG,KMPVFLAG) ; Return configuration by monitor in array
+1 ; to be deprecated
+2 KILL KMPVCFG
SET U="^"
+3 NEW KMPVIEN,KMPV0,KMPV1,KMPV2,KMPV3,KMPV4
+4 IF $DATA(^KMPV(8969,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969,"B",KMPVMKEY,""))
+5 if $GET(KMPVIEN)=""
QUIT
+6 SET KMPV0=$GET(^KMPV(8969,KMPVIEN,0))
SET KMPV1=$GET(^KMPV(8969,KMPVIEN,1))
+7 SET KMPV2=$GET(^KMPV(8969,KMPVIEN,2))
SET KMPV3=$GET(^KMPV(8969,KMPVIEN,3))
SET KMPV4=$GET(^KMPV(8969,KMPVIEN,4))
+8 SET KMPVCFG("ONOFF")=$$GETVAL(KMPVMKEY,"ONOFF",8969,$GET(KMPVFLAG))
SET KMPVCFG("VERSION")=$PIECE(KMPV0,U,4)
+9 SET KMPVCFG("VERSION INSTALL DATE")=$PIECE(KMPV0,U,5)
SET KMPVCFG("DAYS TO KEEP DATA")=$PIECE(KMPV1,U)
+10 SET KMPVCFG("COLLECTION INTERVAL")=$PIECE(KMPV1,U,2)
SET KMPVCFG("CACHE DAILY TASK")=$PIECE(KMPV1,U,3)
+11 SET KMPVCFG("ALLOW TEST SYSTEM")=$$GETVAL(KMPVMKEY,"ALLOW TEST SYSTEM",8969,$GET(KMPVFLAG))
SET KMPVCFG("HTTP REQUEST MAX LENGTH")=$PIECE(KMPV1,U,5)
+12 SET KMPVCFG("MONITOR START DELAY")=$PIECE(KMPV1,U,6)
SET KMPVCFG("TASKMAN OPTION")=$PIECE(KMPV1,U,7)
+13 SET KMPVCFG("ENCRYPT")=$PIECE(KMPV1,U,9)
+14 SET KMPVCFG("LAST START TIME")=$PIECE(KMPV2,U)
SET KMPVCFG("LAST STOP TIME")=$PIECE(KMPV2,U,2)
+15 SET KMPVCFG("LAST RUN TIME")=$PIECE(KMPV2,U,3)
SET KMPVCFG("NATIONAL DATA EMAIL ADDRESS")=$PIECE(KMPV3,U)
+16 SET KMPVCFG("NATIONAL SUPPORT EMAIL ADDRESS")=$PIECE(KMPV3,U,2)
+17 SET KMPVCFG("VSM CFG EMAIL ADDRESS")=$PIECE(KMPV3,U,3)
SET KMPVCFG("LOCAL SUPPORT EMAIL ADDRESS")=$PIECE(KMPV3,U,4)
+18 SET KMPVCFG("NATIONAL IP ADDRESS")=$PIECE(KMPV4,U,1)
SET KMPVCFG("NATIONAL FQDN")=$PIECE(KMPV4,U,2)
+19 SET KMPVCFG("NATIONAL PORT")=$PIECE(KMPV4,U,3)
SET KMPVCFG("APIKEY")=$PIECE(KMPV4,U,4)
+20 QUIT
+21 ;
GETDEF(KMPVMKEY,KMPVDEF,KMPVFLAG) ; Return default configuration in array
+1 ; to be deprecated - fields have changed
+2 KILL KMPVDEF
SET U="^"
+3 NEW KMPVIEN,KMPV0,KMPV1
+4 IF $DATA(^KMPV(8969.02,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969.02,"B",KMPVMKEY,""))
+5 if $GET(KMPVIEN)=""
QUIT
+6 SET KMPV0=$GET(^KMPV(8969.02,KMPVIEN,0))
SET KMPV1=$GET(^KMPV(8969.02,KMPVIEN,1))
+7 SET KMPV2=$GET(^KMPV(8969.02,KMPVIEN,2))
+8 WRITE KMPV0
+9 SET KMPVDEF("DAYS TO KEEP DATA")=$PIECE(KMPV0,U,2)
SET KMPVDEF("COLLECTION INTERVAL")=$PIECE(KMPV0,U,3)
+10 SET KMPVDEF("CACHE DAILY TASK")=$PIECE(KMPV0,U,4)
SET KMPVDEF("ALLOW TEST SYSTEM")=$PIECE(KMPV0,U,5)
+11 SET KMPVDEF("TASKMAN SCHEDULE FREQUENCY")=$PIECE(KMPV0,U,6)
SET KMPVDEF("TASKMAN SCHEDULE START")=$PIECE(KMPV0,U,7)
+12 SET KMPVDEF("TASKMAN OPTION")=$PIECE(KMPV0,U,8)
SET KMPVDEF("START PERFMON")=$PIECE(KMPV0,U,9)
+13 SET KMPVDEF("ENCRYPT")=$PIECE(KMPV0,U,10)
SET KMPVDEF("NATIONAL DATA EMAIL ADDRESS")=$PIECE(KMPV1,U)
+14 SET KMPVDEF("NATIONAL SUPPORT EMAIL ADDRESS")=$PIECE(KMPV1,U,2)
SET KMPVDEF("VSM CFG EMAIL ADDRESS")=$PIECE(KMPV1,U,3)
+15 SET KMPVDEF("NATIONAL IP ADDRESS")=$PIECE(KMPV2,U,1)
SET KMPVDEF("NATIONAL FQDN")=$PIECE(KMPV2,U,2)
+16 SET KMPVDEF("NATIONAL PORT")=$PIECE(KMPV2,U,3)
SET KMPVDEF("APIKEY")=$PIECE(KMPV2,U,4)
+17 QUIT
+18 ;
CFGSTR(KMPVMKEY,KMPVFLAG) ; Return configuration in "^" delimited string
+1 SET U="^"
+2 NEW KMPVCFG,KMPVIEN,KMPRT,KMPV0,KMPV1,KMPV2,KMPV3
+3 IF $DATA(^KMPV(8969,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969,"B",KMPVMKEY,""))
+4 if $GET(KMPVIEN)=""
QUIT ""
+5 SET KMPVCFG=""
+6 SET KMPV0=$GET(^KMPV(8969,KMPVIEN,0))
SET KMPV1=$GET(^KMPV(8969,KMPVIEN,1))
+7 SET KMPRT=$SELECT($$GETVAL^KMPVCCFG(KMPVMKEY,"VERSION",8969)>2:1,1:0)
+8 ; MONITOR KEY^ONOFF^VERSION^VERSION INSTALL DATE^DAYS TO KEEP DATA^COLLECTION INTERVAL^HTTP REQUEST MAX LENGTH^MONITOR START DELAY^ALLOW TEST
+9 ; ^CACHE DAILY TASK^TASKMAN TASK^REALTIME^START PERFMON^ENCRYPT
+10 SET KMPVCFG=KMPVMKEY_U_$$GETVAL(KMPVMKEY,"ONOFF",8969,$GET(KMPVFLAG))_U_$PIECE(KMPV0,U,4)_U_$PIECE(KMPV0,U,5)_U_$PIECE(KMPV1,U,1)_U_$PIECE(KMPV1,U,2)_U
+11 SET KMPVCFG=KMPVCFG_$PIECE(KMPV1,U,5)_U_$PIECE(KMPV1,U,6)_U_$$GETVAL(KMPVMKEY,"ALLOW TEST SYSTEM",8969,$GET(KMPVFLAG))_U
+12 SET KMPVCFG=KMPVCFG_$PIECE(KMPV1,U,3)_U_$PIECE(KMPV1,U,7)_U_KMPRT_U_$PIECE(KMPV1,U,8)_U_$PIECE(KMPV1,U,9)
+13 QUIT KMPVCFG
+14 ;
GETVAL(KMPVMKEY,KMPVFLD,KMPVFILE,KMPVFLAG) ; retrieve value from VSM CONFIGURATION or VSM MONITOR DEFAULTS files
+1 NEW KMPVIEN
+2 IF KMPVFILE=8969
IF $DATA(^KMPV(8969,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969,"B",KMPVMKEY,""))
+3 IF KMPVFILE=8969.02
IF $DATA(^KMPV(8969.02,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969.02,"B",KMPVMKEY,""))
+4 if $GET(KMPVIEN)=""
QUIT ""
+5 QUIT $$GET1^DIQ(KMPVFILE,KMPVIEN,KMPVFLD,$GET(KMPVFLAG))
+6 ;
+7 ; SETTER FUNCTIONS
+8 ;
SETONE(KMPVMKEY,KMPVFNAM,KMPVNVAL,KMPVERR) ; set a value into the VSM CONFIGURATION file
+1 KILL KMPVERR,KMPVEARR
+2 NEW FDA,KMPVIEN,KMPVEARR,KMPVOVAL,KMPVSTAT,KMPVUP
+3 SET KMPVSTAT=0
SET KMPVLOG=+$GET(KMPVLOG)
+4 SET KMPVOVAL=$$GETVAL(KMPVMKEY,KMPVFNAM,8969)
+5 IF KMPVOVAL=KMPVNVAL
QUIT KMPVSTAT
+6 IF $DATA(^KMPV(8969,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969,"B",KMPVMKEY,""))
+7 IF $GET(KMPVIEN)=""
SET KMPVSTAT="1^MONITOR TYPE NOT CONFIGURED"
QUIT KMPVSTAT
+8 SET KMPVFNUM=$$FLDNUM^DILFD(8969,KMPVFNAM)
+9 IF +KMPVFNUM=0
SET KMPVSTAT="1^FIELD NAME '"_KMPVFNAM_"' DOES NOT EXIST"
QUIT KMPVSTAT
+10 SET FDA($JOB,8969,KMPVIEN_",",KMPVFNUM)=KMPVNVAL
+11 DO FILE^DIE("ET","FDA($J)","KMPVEARR")
+12 IF $DATA(KMPVEARR)
Begin DoDot:1
+13 MERGE KMPVERR=KMPVEARR
+14 SET KMPVSTAT="1^FILING ERROR"
End DoDot:1
QUIT KMPVSTAT
+15 QUIT KMPVSTAT
+16 ;
SETVALS(KMPVMKEY,KMPVFVAL,KMPVERR,KMPVLOG) ; set multiple values into the VSM CONFIGURATION file
+1 ; KMPVFVAL(FieldName)=FieldValue, KMPVERR: Output array if errors
+2 KILL KMPVERR,KMPVEARR
+3 NEW FDA,KMPVDATA,KMPVIEN,KMVEARR,KMPVFNAM,KMPVFNUM,KMPVSTAT
+4 SET KMPVSTAT=0
SET KMPVLOG=+$GET(KMPVLOG)
+5 IF $DATA(^KMPV(8969,"B",KMPVMKEY))
SET KMPVIEN=$ORDER(^KMPV(8969,"B",KMPVMKEY,""))
+6 IF $GET(KMPVIEN)=""
SET KMPVSTAT="1^MONITOR TYPE NOT CONFIGURED"
QUIT KMPVSTAT
+7 ; get field numbers and set FDA array
+8 SET KMPVFNAM=""
+9 FOR
SET KMPVFNAM=$ORDER(KMPVFVAL(KMPVFNAM))
if KMPVFNAM=""
QUIT
Begin DoDot:1
+10 SET KMPVFNUM=$$FLDNUM^DILFD(8969,KMPVFNAM)
+11 IF KMPVFNUM>0
SET FDA($JOB,8969,KMPVIEN_",",KMPVFNUM)=KMPVFVAL(KMPVFNAM)
+12 IF '$TEST
SET KMPVEARR(KMPVFNAM)=""
End DoDot:1
+13 ; If field name does not exist set error array and quit
+14 IF $DATA(KMPVEARR)
Begin DoDot:1
+15 SET KMPVSTAT="1^FIELD NAME DOES NOT EXIST"
+16 MERGE KMPVERR=KMPVEARR
End DoDot:1
QUIT KMPVSTAT
+17 DO FILE^DIE("ET","FDA($J)","KMPVEARR")
+18 ; If filing errors set error array
+19 IF $DATA(KMPVEARR)
Begin DoDot:1
+20 MERGE KMPVERR=KMPVEARR
+21 SET KMPVSTAT="1^FILING ERROR"
End DoDot:1
QUIT KMPVSTAT
+22 QUIT KMPVSTAT
+23 ;
+24 ; OTHER FUNCTIONS
+25 ;
RESTCFG(KMPVMKEY,KMPUSER,KMPVERR) ; Restore default configuration to VSM CONFIGURATION file
+1 NEW KMPVSTAT
+2 DO GETDEF(KMPVMKEY,.KMPVDEF)
+3 SET KMPVSTAT=$$SETVALS(KMPVMKEY,.KMPVDEF,.KMPVERR)
+4 DO CFGMSG^KMPUTLW($GET(KMPUSER))
+5 QUIT KMPVSTAT
+6 ;
STRSTP(KMPVMKEY,KMPVSTIME) ; Record run time values
+1 if KMPVMKEY=""
QUIT
+2 if KMPVSTIME=""
QUIT
+3 NEW %,%H,X,KMPVETFM,KMPVFVAL,KMPVSTAT,KMPVSTFM,KMPVTDIFF
+4 SET %H=KMPVSTIME
DO YMD^%DTC
SET KMPVSTFM=X_%
+5 SET %H=$HOROLOG
DO YMD^%DTC
SET KMPVETFM=X_%
+6 SET KMPVTDIFF=$$FMDIFF^XLFDT(KMPVETFM,KMPVSTFM,2)
+7 SET KMPVFVAL("LAST START TIME")=KMPVSTFM
+8 SET KMPVFVAL("LAST STOP TIME")=KMPVETFM
+9 SET KMPVFVAL("LAST RUN TIME")=KMPVTDIFF
+10 SET KMPVSTAT=$$SETVALS(KMPVMKEY,.KMPVFVAL,.KMPVEARR,1)
+11 QUIT
+12 ;
SYSCFG() ; Return system configuration values
+1 ; IA 10097
QUIT $$VERSION^%ZOSV(1)_"^"_$$OS^%ZOSV_"^"_$$VERSION^%ZOSV(0)_"^"_$$PROD()
+2 ;
MONSTAT(KMPVTEXT) ; Return status information for all configured monitors
+1 KILL KMPVTEXT
+2 NEW KMPCNT,KMPI,KMPVBGD,KMPVCDAYS,KMPVCOMP,KMPVDDAYS,KMPVDLY,KMPVENT,KMPVI,KMPVML,KMPVMKEY,KMPVOPT,KMPVTASK,Y
+3 ;
+4 DO MONLIST^KMPVCBG(.KMPVML)
+5 SET KMPVMKEY=""
+6 FOR
SET KMPVMKEY=$ORDER(KMPVML(KMPVMKEY))
if KMPVMKEY=""
QUIT
Begin DoDot:1
+7 SET KMPVTEXT(KMPVMKEY)=KMPVML(KMPVMKEY)
+8 DO CFGARR(KMPVMKEY,.KMPVCFG)
+9 SET KMPVTEXT(KMPVMKEY,"ONOFF")=KMPVCFG("ONOFF")
+10 SET KMPI=""
SET KMPCNT=0
+11 FOR
SET KMPI=$ORDER(^KMPTMP("KMPV",KMPVMKEY,"RETRY",KMPI))
if KMPI=""
QUIT
SET KMPCNT=KMPCNT+1
+12 SET KMPVTEXT(KMPVMKEY,"RETRY")=KMPCNT
+13 SET KMPVTEXT(KMPVMKEY,"VERSION")=$$GETVAL^KMPVCCFG(KMPVMKEY,"VERSION",8969)
End DoDot:1
+14 QUIT
+15 ;
USERNAME(KMPVDUZ) ; Return users name from DUZ
+1 NEW KMPVNAME,KMPVOUT
+2 ; IA 10060 for lookup into NEW PERSON file
+3 IF +KMPVDUZ'>0
QUIT ""
+4 DO FIND^DIC(200,"","","A",KMPVDUZ,"","","","","KMPVOUT")
+5 SET KMPVNAME=$GET(KMPVOUT("DILIST",1,1))
+6 QUIT KMPVNAME
+7 ;
PROD() ; Return "prod" if production, "test" otherwise
+1 NEW KMPVPROD
+2 ; IA 4440
SET KMPVPROD=$$PROD^XUPROD()
+3 SET KMPVPROD=$SELECT(KMPVPROD=1:"prod",1:"test")
+4 QUIT KMPVPROD
+5 ;
SITEINFO() ;
+1 NEW KMPVDOM,KMPVSINF,KMPVPROD,KMPVSCD,KMPVSITE
+2 SET KMPVPROD=$$PROD^KMPVCCFG()
+3 ;IA 2734
SET KMPVDOM=$PIECE($$NETNAME^XMXUTIL(.5),"@",2)
+4 DO NOW^%DTC
+5 ;IA 10112
SET KMPVSITE=$$SITE^VASITE($PIECE(%,"."))
+6 ; IA 10097
DO GETENV^%ZOSV
SET KMPVSCD=$PIECE(Y,U,1)
+7 SET KMPVSINF=$PIECE(KMPVSITE,U,2)_"^"_$PIECE(KMPVSITE,U,3)_"^"_KMPVDOM_"^"_KMPVPROD_"^"_KMPVSCD
+8 QUIT KMPVSINF
+9 ;
SLOT(KMPTIME,KMPSINT,KMPTFORM) ;
+1 ; NOTE: code in %ZOSVKR similar. All other VSM monitors call here.
+2 NEW X,%T,%H,KMPSSEC,KMPSEC,X,KMPSLOT,KMPSTIME
+3 SET KMPSSEC=KMPSINT*60
+4 IF KMPTFORM="HOROLOG"
Begin DoDot:1
+5 SET KMPSEC=$PIECE(KMPTIME,",",2)
End DoDot:1
+6 IF KMPTFORM="FILEMAN"
Begin DoDot:1
+7 SET X=KMPTIME
DO H^%DTC
SET KMPSEC=%T
+8 IF KMPSEC>86399
SET KMPSEC=86399
End DoDot:1
+9 SET KMPSLOT=KMPSEC\KMPSSEC
+10 SET KMPSTIME=KMPSLOT*KMPSSEC
+11 QUIT KMPSTIME
+12 ;
ISBENODE(KMPNODE) ;
+1 NEW RET,KMPINST,KMPNTYP
+2 SET RET=0
+3 if $PIECE(KMPNODE,"
QUIT -1
+4 SET KMPINST=$PIECE(KMPNODE,":",2)
+5 IF $EXTRACT(KMPINST,7,9)="SVR"
SET RET=1
+6 QUIT RET