KMPRBD03 ;SFISC/RAK - Resource Usage Monitor Data Compression ;10 Oct 98
;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
;
; Background Driver (cont.)
;
FILE(KMPRDATE,KMPRNODE,KMPROPT,KMPRPT,KMPRNP,KMPRPTHR,KMPRNPHR,KMPROK,KMPRMSG) ;
;-----------------------------------------------------------------------
; KMPRDATE.... Date in $H Format
; KMPRNODE.... Node Name
; KMPROPT..... Option (in 2 pieces with "***" as delimiter)
; piece 1 - option name
; piece 2 - protocol (optional)
; KMPRPT...... Prime Time Data (8 elements)
; KMPRNP...... Non Prime Data (8 elements)
; KMPRPTHR.... Number of Prime Time Hours
; KMPRNPHR.... Number of Non Prime Hours
; KMPROK...... Returns: 0 - update not successful
; 1 - update successful
; KMPRMSG..... If KMPROK = 0 then message text will be returned in this
; array (passed by reference).
;
; File data in file #8971.1 (RESOUCE USAGE MONITOR).
;-----------------------------------------------------------------------
;
S KMPROK=0
Q:'$G(KMPRDATE)
Q:$G(KMPRNODE)=""
Q:$G(KMPROPT)=""
S KMPRPT=$G(KMPRPT),KMPRNP=$G(KMPRNP)
S KMPRPTHR=+$G(KMPRPTHR),KMPRNPHR=+$G(KMPRNPHR)
S KMPROK=1
K KMPRMSG
;
N FDA,I,J,MESSAGE,OPT,ZIEN
;
; date.
S FDA($J,8971.1,"+1,",.01)=$$HTFM^XLFDT(KMPRDATE)
; sent to cm national database.
S FDA($J,8971.1,"+1,",.02)=0
; node.
S FDA($J,8971.1,"+1,",.03)=KMPRNODE
; option.
S OPT=$P(KMPROPT,"***")
; rum designation.
S FDA($J,8971.1,"+1,",.08)=$$RUMDESIG(OPT)
; if the first character of OPT is '`' then this is an RPC.
I $E(OPT)="`" S FDA($J,8971.1,"+1,",.07)=$E(OPT,2,999)
; if the first character of OPT is '&' then this is an HL7.
E I $E(OPT)="&" S FDA($J,8971.1,"+1,",.09)=$E(OPT,2,999)
; option.
E S FDA($J,8971.1,"+1,",.04)=$$OPTION(OPT)
; protocol.
S:$P(KMPROPT,"***",2)'="" FDA($J,8971.1,"+1,",.05)=$P(KMPROPT,"***",2)
;
; populate prime time and non-prime time fields.
F I=1:1:8 S J=I*.01 D
.; prime time - node 1.
.I $P(KMPRPT,U,I)'=""&(KMPRPTHR) D
..S FDA($J,8971.1,"+1,",1+J)=$FN($P(KMPRPT,U,I),"",2)
.; non-prime time - node 2
.I $P(KMPRNP,U,I)'=""&(KMPRNPHR) D
..S FDA($J,8971.1,"+1,",2+J)=$FN($P(KMPRNP,U,I),"",2)
;
; update file 8971.1.
D UPDATE^DIE("","FDA($J)","ZIEN","MESSAGE")
; if error message.
I $D(MESSAGE) S KMPROK=0 D MSG^DIALOG("A",.KMPRMSG,60,10,"MESSAGE")
;
Q
;
RUMDESIG(KMPROPT) ;-- extrinsic function - determine rum designation.
;-----------------------------------------------------------------------
; KMPROPT... Option name.
;
; Return: RUM Designation (see field #.08 RUM DESIGNATION in file
; #8971.1).
;-----------------------------------------------------------------------
;
; 5 = other.
Q:$G(KMPROPT)="" 5
; 1 = taskman
Q:KMPROPT="$AFTR ZTMS$"!(KMPROPT="$STRT ZTMS$")!($E(KMPROPT)="!") 1
; 3 = broker.
Q:$E(KMPROPT)="`" 3
; 4 = hl7
Q:$E(KMPROPT)="&" 4
; 2 - user.
Q 2
;
OPTION(KMPROPT) ;-- extrinsic function - option name.
;-----------------------------------------------------------------------
; KMPROPT... Option name (as it appears from ^XTMP("KMPR","HR").
;
; Return: Option name with extraneous characters removed.
;-----------------------------------------------------------------------
;
Q:$G(KMPROPT)="" ""
Q:$E(KMPROPT)="!" $E(KMPROPT,2,999)
; rpc.
Q:$E(KMPROPT)="`" ""
; hl7.
Q:$E(KMPROPT)="&" ""
Q KMPROPT
KMPRBD03 ;SFISC/RAK - Resource Usage Monitor Data Compression ;10 Oct 98
+1 ;;1.0;CAPACITY MANAGEMENT - RUM;;Dec 09, 1998
+2 ;
+3 ; Background Driver (cont.)
+4 ;
FILE(KMPRDATE,KMPRNODE,KMPROPT,KMPRPT,KMPRNP,KMPRPTHR,KMPRNPHR,KMPROK,KMPRMSG) ;
+1 ;-----------------------------------------------------------------------
+2 ; KMPRDATE.... Date in $H Format
+3 ; KMPRNODE.... Node Name
+4 ; KMPROPT..... Option (in 2 pieces with "***" as delimiter)
+5 ; piece 1 - option name
+6 ; piece 2 - protocol (optional)
+7 ; KMPRPT...... Prime Time Data (8 elements)
+8 ; KMPRNP...... Non Prime Data (8 elements)
+9 ; KMPRPTHR.... Number of Prime Time Hours
+10 ; KMPRNPHR.... Number of Non Prime Hours
+11 ; KMPROK...... Returns: 0 - update not successful
+12 ; 1 - update successful
+13 ; KMPRMSG..... If KMPROK = 0 then message text will be returned in this
+14 ; array (passed by reference).
+15 ;
+16 ; File data in file #8971.1 (RESOUCE USAGE MONITOR).
+17 ;-----------------------------------------------------------------------
+18 ;
+19 SET KMPROK=0
+20 IF '$GET(KMPRDATE)
QUIT
+21 IF $GET(KMPRNODE)=""
QUIT
+22 IF $GET(KMPROPT)=""
QUIT
+23 SET KMPRPT=$GET(KMPRPT)
SET KMPRNP=$GET(KMPRNP)
+24 SET KMPRPTHR=+$GET(KMPRPTHR)
SET KMPRNPHR=+$GET(KMPRNPHR)
+25 SET KMPROK=1
+26 KILL KMPRMSG
+27 ;
+28 NEW FDA,I,J,MESSAGE,OPT,ZIEN
+29 ;
+30 ; date.
+31 SET FDA($JOB,8971.1,"+1,",.01)=$$HTFM^XLFDT(KMPRDATE)
+32 ; sent to cm national database.
+33 SET FDA($JOB,8971.1,"+1,",.02)=0
+34 ; node.
+35 SET FDA($JOB,8971.1,"+1,",.03)=KMPRNODE
+36 ; option.
+37 SET OPT=$PIECE(KMPROPT,"***")
+38 ; rum designation.
+39 SET FDA($JOB,8971.1,"+1,",.08)=$$RUMDESIG(OPT)
+40 ; if the first character of OPT is '`' then this is an RPC.
+41 IF $EXTRACT(OPT)="`"
SET FDA($JOB,8971.1,"+1,",.07)=$EXTRACT(OPT,2,999)
+42 ; if the first character of OPT is '&' then this is an HL7.
+43 IF '$TEST
IF $EXTRACT(OPT)="&"
SET FDA($JOB,8971.1,"+1,",.09)=$EXTRACT(OPT,2,999)
+44 ; option.
+45 IF '$TEST
SET FDA($JOB,8971.1,"+1,",.04)=$$OPTION(OPT)
+46 ; protocol.
+47 IF $PIECE(KMPROPT,"***",2)'=""
SET FDA($JOB,8971.1,"+1,",.05)=$PIECE(KMPROPT,"***",2)
+48 ;
+49 ; populate prime time and non-prime time fields.
+50 FOR I=1:1:8
SET J=I*.01
Begin DoDot:1
+51 ; prime time - node 1.
+52 IF $PIECE(KMPRPT,U,I)'=""&(KMPRPTHR)
Begin DoDot:2
+53 SET FDA($JOB,8971.1,"+1,",1+J)=$FNUMBER($PIECE(KMPRPT,U,I),"",2)
End DoDot:2
+54 ; non-prime time - node 2
+55 IF $PIECE(KMPRNP,U,I)'=""&(KMPRNPHR)
Begin DoDot:2
+56 SET FDA($JOB,8971.1,"+1,",2+J)=$FNUMBER($PIECE(KMPRNP,U,I),"",2)
End DoDot:2
End DoDot:1
+57 ;
+58 ; update file 8971.1.
+59 DO UPDATE^DIE("","FDA($J)","ZIEN","MESSAGE")
+60 ; if error message.
+61 IF $DATA(MESSAGE)
SET KMPROK=0
DO MSG^DIALOG("A",.KMPRMSG,60,10,"MESSAGE")
+62 ;
+63 QUIT
+64 ;
RUMDESIG(KMPROPT) ;-- extrinsic function - determine rum designation.
+1 ;-----------------------------------------------------------------------
+2 ; KMPROPT... Option name.
+3 ;
+4 ; Return: RUM Designation (see field #.08 RUM DESIGNATION in file
+5 ; #8971.1).
+6 ;-----------------------------------------------------------------------
+7 ;
+8 ; 5 = other.
+9 IF $GET(KMPROPT)=""
QUIT 5
+10 ; 1 = taskman
+11 IF KMPROPT="$AFTR ZTMS$"!(KMPROPT="$STRT ZTMS$")!($EXTRACT(KMPROPT)="!")
QUIT 1
+12 ; 3 = broker.
+13 IF $EXTRACT(KMPROPT)="`"
QUIT 3
+14 ; 4 = hl7
+15 IF $EXTRACT(KMPROPT)="&"
QUIT 4
+16 ; 2 - user.
+17 QUIT 2
+18 ;
OPTION(KMPROPT) ;-- extrinsic function - option name.
+1 ;-----------------------------------------------------------------------
+2 ; KMPROPT... Option name (as it appears from ^XTMP("KMPR","HR").
+3 ;
+4 ; Return: Option name with extraneous characters removed.
+5 ;-----------------------------------------------------------------------
+6 ;
+7 IF $GET(KMPROPT)=""
QUIT ""
+8 IF $EXTRACT(KMPROPT)="!"
QUIT $EXTRACT(KMPROPT,2,999)
+9 ; rpc.
+10 IF $EXTRACT(KMPROPT)="`"
QUIT ""
+11 ; hl7.
+12 IF $EXTRACT(KMPROPT)="&"
QUIT ""
+13 QUIT KMPROPT