source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_RUM-KMPR/KMPRBD03.m@ 1780

Last change on this file since 1780 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.5 KB
Line 
1KMPRBD03 ;OAK/RAK - Resource Usage Monitor Data Compression ;5/28/03 08:38
2 ;;2.0;CAPACITY MANAGEMENT - RUM;;May 28, 2003
3 ;
4 ; Background Driver (cont.)
5 ;
6FILE(KMPRDATE,KMPRNODE,KMPROPT,KMPRPT,KMPRNP,KMPRPTHR,KMPRNPHR,KMPROK,KMPRMSG) ;
7 ;-----------------------------------------------------------------------
8 ; KMPRDATE.... Date in $H Format
9 ; KMPRNODE.... Node Name
10 ; KMPROPT..... Option (in 2 pieces with "***" as delimiter)
11 ; piece 1 - option name
12 ; piece 2 - protocol (optional)
13 ; KMPRPT().... Array for Prime Time data - passed by reference
14 ; (1)... Prime Time Data (8 elements)
15 ; (1.1). Hour count (24 hours)
16 ; (1.2). User count (24 hours)
17 ; KMPRNP().... Array fo Non-Prime data - passed by reference
18 ; (1)... Non-Prime Time Data (8 elements)
19 ; (1.1). Hour count (24 hours)
20 ; (1.2). User count (24 hours)
21 ; KMPRPTHR.... Number of Prime Time Hours
22 ; KMPRNPHR.... Number of Non Prime Hours
23 ; KMPROK...... Returns: 0 - update not successful
24 ; 1 - update successful
25 ; KMPRMSG..... If KMPROK = 0 then message text will be returned in this
26 ; array (passed by reference)
27 ;
28 ; File data in file #8971.1 (RESOUCE USAGE MONITOR)
29 ;-----------------------------------------------------------------------
30 ;
31 S KMPROK=0
32 Q:'$G(KMPRDATE)
33 Q:$G(KMPRNODE)=""
34 Q:$G(KMPROPT)=""
35 Q:'$D(KMPRPT)&('$D(KMPRNP))
36 S KMPRPTHR=+$G(KMPRPTHR),KMPRNPHR=+$G(KMPRNPHR)
37 S KMPROK=1
38 K KMPRMSG
39 ;
40 N FDA,FMDATE,I,J,MESSAGE,OPT,WORKDAY,ZIEN
41 ;
42 S FMDATE=$$HTFM^XLFDT(KMPRDATE),WORKDAY=$$WORKDAY^XUWORKDY(FMDATE)
43 ;
44 ; date
45 S FDA($J,8971.1,"+1,",.01)=FMDATE
46 ; sent to cm national database
47 S FDA($J,8971.1,"+1,",.02)=0
48 ; cpu node
49 S FDA($J,8971.1,"+1,",.03)=KMPRNODE
50 ; option
51 S OPT=$P(KMPROPT,"***")
52 ; rum designation
53 S FDA($J,8971.1,"+1,",.08)=$$RUMDESIG(OPT)
54 ; if the first character of OPT is '`' then this is an RPC
55 I $E(OPT)="`" S FDA($J,8971.1,"+1,",.07)=$E(OPT,2,999)
56 ; if the first character of OPT is '&' then this is an HL7
57 E I $E(OPT)="&" S FDA($J,8971.1,"+1,",.09)=$E(OPT,2,999)
58 ; option
59 E S FDA($J,8971.1,"+1,",.04)=$$OPTION(OPT)
60 ; protocol
61 S:$P(KMPROPT,"***",2)'="" FDA($J,8971.1,"+1,",.05)=$P(KMPROPT,"***",2)
62 ;
63 ;--Populate prime time, non-prime time and non-workday fields
64 F I=1:1:8 S J=I*.01 D
65 .;
66 .; subscript 1 - workday prime time (PT)
67 .I $P($G(KMPRPT(1)),U,I)'=""&(KMPRPTHR) D
68 ..S FDA($J,8971.1,"+1,",1+J)=$FN($P(KMPRPT(1),U,I),"",2)
69 .;
70 .I $P($G(KMPRNP(1)),U,I)'=""&(KMPRNPHR) D
71 ..; subscript 2 - workday non-prime time (NP)
72 ..I WORKDAY S FDA($J,8971.1,"+1,",2+J)=$FN($P(KMPRNP(1),U,I),"",2)
73 ..; subscript 3 - entire non-workday time (NW)
74 ..E S FDA($J,8971.1,"+1,",3+J)=$FN($P(KMPRNP(1),U,I),"",2)
75 ;
76 ;--Populate workday and non-workday hourly occurrence and user counts
77 ; non-workday is considered non-prime time
78 F I=1:1:24 S J=I*.001 D
79 .;
80 .; subscript 1.1 - workday (WD) hourly occurrence counts
81 .I $P($G(KMPRPT(1.1)),U,I)'="" D
82 ..S FDA($J,8971.1,"+1,",1.1+J)=$P(KMPRPT(1.1),U,I)
83 .;
84 .; subscript 1.2 - workday (WD) hourly user counts
85 .I $P($G(KMPRPT(1.2)),U,I)'="" D
86 ..S FDA($J,8971.1,"+1,",1.2+J)=$P(KMPRPT(1.2),U,I)
87 .;
88 .; subscript 2.1 - non-workday (NW) hourly occurrence counts
89 .I $P($G(KMPRNP(1.1)),U,I)'="" D
90 ..S FDA($J,8971.1,"+1,",2.1+J)=$P(KMPRNP(1.1),U,I)
91 .;
92 .; subscript 2.2 - non-workday (NW) hourly user counts
93 .I $P($G(KMPRNP(1.2)),U,I)'="" D
94 ..S FDA($J,8971.1,"+1,",2.2+J)=$P(KMPRNP(1.2),U,I)
95 ;
96 ; update file 8971.1
97 D UPDATE^DIE("","FDA($J)","ZIEN","MESSAGE")
98 ; if error message
99 I $D(MESSAGE) S KMPROK=0 D MSG^DIALOG("A",.KMPRMSG,60,10,"MESSAGE")
100 ;
101 Q
102 ;
103RUMDESIG(KMPROPT) ;-- extrinsic function - determine rum designation
104 ;-----------------------------------------------------------------------
105 ; KMPROPT... Option name
106 ;
107 ; Return: RUM Designation (see field #.08 RUM DESIGNATION in file
108 ; #8971.1)
109 ;-----------------------------------------------------------------------
110 ;
111 ; 5 = other
112 Q:$G(KMPROPT)="" 5
113 ; 1 = taskman
114 Q:KMPROPT="$AFTR ZTMS$"!(KMPROPT="$STRT ZTMS$")!($E(KMPROPT)="!") 1
115 ; 3 = broker
116 Q:$E(KMPROPT)="`" 3
117 ; 4 = users
118 Q:$E(KMPROPT)="#" 4
119 ; 2 - option
120 Q 2
121 ;
122OPTION(KMPROPT) ;-- extrinsic function - option name
123 ;-----------------------------------------------------------------------
124 ; KMPROPT... Option name as it appears from ^KMPTMP("KMPR","DLY")
125 ;
126 ; Return: Option name with extraneous characters removed
127 ;-----------------------------------------------------------------------
128 ;
129 Q:$G(KMPROPT)="" ""
130 Q:$E(KMPROPT)="!" $E(KMPROPT,2,999)
131 ; rpc
132 Q:$E(KMPROPT)="`" ""
133 Q KMPROPT
Note: See TracBrowser for help on using the repository browser.