source: WorldVistAEHR/trunk/r/CAPACITY_MANAGEMENT_TOOLS-KMPD-KMPL/KMPDU3.m@ 634

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1KMPDU3 ;OAK/RAK - CM Tools Utilities ;7/22/04 09:10
2 ;;2.0;CAPACITY MANAGEMENT TOOLS;**2**;Mar 22, 2002
3 ;
4ERRDATA(KMPDY,KMPDIEN,KMPDGBL) ;-- error log data.
5 ;-----------------------------------------------------------------------
6 ; KMPDIEN. Ien in format 'multiple,ien'.
7 ; KMPDGBL... Global where data is stored.
8 ;-----------------------------------------------------------------------
9 ;
10 K KMPDY
11 ;
12 I $G(KMPDIEN)="" S @KMPDGBL@(0)="[IEN not defined]" Q
13 ;
14 I KMPDGBL="" S @KMPDGBL@(0)="[Global for storage is not defined]" Q
15 ;
16 N DATA,DATA1,I,IEN,IEN1,LN
17 ;
18 ; kill global with check for ^tmp or ^utility.
19 D KILL^KMPDU(.DATA,KMPDGBL)
20 ; if error.
21 I $E(DATA)="[" S @KMPDGBL@(0)=DATA Q
22 ;
23 S IEN1=$P(KMPDIEN,",")
24 I 'IEN1 S @KMPDGBL@(0)="[IEN1 not defined]" Q
25 S IEN=$P(KMPDIEN,",",2)
26 I 'IEN S @KMPDGBL@(0)="[IEN not defined]" Q
27 ;
28 S DATA=$G(^%ZTER(1,IEN,0))
29 I DATA="" S @KMPDGBL@(0)="[No data for "_KMPDIEN_"]" Q
30 ;
31 ; $h date in external format.
32 S @KMPDGBL@(0)=$$HTE^XLFDT(+DATA)
33 ; error text.
34 S @KMPDGBL@(1)=$G(^%ZTER(1,IEN,1,IEN1,"ZE"))
35 S @KMPDGBL@(2)="",LN=3
36 ; last global reference.
37 I $G(^%ZTER(1,IEN,1,IEN1,"GR"))'="" D
38 .S @KMPDGBL@(LN)="Last Global Reference: "_^("GR"),LN=LN+1
39 ; $h.
40 I $G(^%ZTER(1,IEN,1,IEN1,"H"))'="" D
41 .S @KMPDGBL@(LN)="$H: "_^("H"),LN=LN+1
42 S DATA=$G(^%ZTER(1,IEN,1,IEN1,"ECODE"))
43 ; $ecode
44 S @KMPDGBL@(LN)="$ECODE = "_$P(DATA,U),LN=LN+1
45 ; $stack
46 S @KMPDGBL@(LN)="$STACK = "_$P(DATA,U,2),LN=LN+1
47 ; $estack
48 S @KMPDGBL@(LN)="$ESTACK = "_$P(DATA,U,3),LN=LN+1
49 ; $quit
50 S @KMPDGBL@(LN)="$QUIT = "_$P(DATA,U,4),LN=LN+1
51 ; $stack multiple.
52 F I=0:0 S I=$O(^%ZTER(1,IEN,1,IEN1,"STACK",I)) Q:'I D
53 .Q:'$D(^%ZTER(1,IEN,1,IEN1,"STACK",I,0)) S DATA=^(0)
54 .S @KMPDGBL@(LN)=$P(DATA,U)_" = "_$P(DATA,U,2)
55 .S LN=LN+1
56 ; variables and data multiple #10.
57 F I=0:0 S I=$O(^%ZTER(1,IEN,1,IEN1,"ZV",I)) Q:'I D
58 .Q:'$D(^%ZTER(1,IEN,1,IEN1,"ZV",I,0)) S DATA=^(0),DATA1=$G(^("D"))
59 .Q:DATA=""
60 .S @KMPDGBL@(LN)=DATA_" = "_$E(DATA1,1,225)
61 .S LN=LN+1
62 ;
63 S KMPDY=$NA(@KMPDGBL)
64 S:'$D(@KMPDGBL) KMPDY="<No Data To Report>"
65 ;
66 Q
67 ;
68ERRDATE(KMPDY,KMPDATE) ;-- get error log date or list all dates
69 ;-----------------------------------------------------------------------
70 ; KMPDATE... Date in internal fileman format, or "*" for a list of all
71 ; available dates.
72 ;
73 ; if one date
74 ; KMPDY(0)=ExternalDate^Ien^NumberOfErrors
75 ;
76 ; or a list of all available dates
77 ; KMPDY(0)=ExternalDate^Ien^NumberOfErrors
78 ; KMPDY(1)=ExternalDate^Ien^NumberOfErrors
79 ; KMPDY(2)=ExternalDate^Ien^NumberOfErrors
80 ; KMPDY(...)=...
81 ;-----------------------------------------------------------------------
82 ;
83 I $G(KMPDATE)="" S KMPDY(0)="[Date entry not defined]" Q
84 ;
85 I KMPDATE'="*" D Q
86 .; external date
87 .S $P(KMPDY(0),U)=$$FMTE^XLFDT(KMPDATE)
88 .; set to date portion of $h format
89 .S KMPDATE=+$$FMTH^XLFDT(KMPDATE)
90 .; ien
91 .S $P(KMPDY(0),U,2)=$O(^%ZTER(1,"B",KMPDATE,0))
92 .; number of errors
93 .S $P(KMPDY(0),U,3)=$P($G(^%ZTER(1,+$P(KMPDY(0),U,2),1,0)),U,3)
94 ;
95 ; if all entries requested
96 I KMPDATE="*" D Q
97 .N DATE,I,LN S (I,LN)=0
98 .F S I=$O(^%ZTER(1,"B",I)) Q:'I I $D(^%ZTER(1,I,0)) D
99 ..; external date
100 ..S $P(KMPDY(LN),U)=$$HTE^XLFDT(I)
101 ..; ien
102 ..S $P(KMPDY(LN),U,2)=I
103 ..; number of errors
104 ..S $P(KMPDY(LN),U,3)=$P($G(^%ZTER(1,I,1,0)),U,3)
105 ..S LN=LN+1
106 ;
107 Q
108 ;
109ROUSAVE(KMPDRES,KMPDRNM,KMPDRCD) ;-- routine save
110 ;-----------------------------------------------------------------------
111 ; KMPDRNM... Routine name.
112 ; KMPDRCD... Array contianing routine code (or text).
113 ;-----------------------------------------------------------------------
114 ;
115 K KMPDRES
116 I $G(KMPDRNM)="" S KMPDRES(0)="[Routine Name not defined]" Q
117 I $L(KMPDRNM)>8 D Q
118 .S KMPDRES(0)="[Routine Name must not be greater than 8 characters]"
119 I '$D(KMPDRCD) D Q
120 .S KMPDRES(0)="[There is no Routine code (text) to save]"
121 ;
122 N DIE,GLOBAL,I,X,XCN
123 S GLOBAL=$NA(^TMP("KMPDU3-1",$J))
124 K @GLOBAL
125 S I=0
126 F S I=$O(KMPDRCD(I)) Q:'I S @GLOBAL@(I,0)=KMPDRCD(I)
127 S X=KMPDRNM,DIE="^TMP("_"""KMPDU3-1"""_","_$J_",",XCN=0
128 X ^%ZOSF("SAVE")
129 ;
130 S KMPDRES(0)="<Routine Saved>"
131 ;
132 Q
133 ;
134ROUSTATS(KMPDRES,KMPDIENS) ;-- routine stats
135 ;-----------------------------------------------------------------------
136 ; KMPDIENS... Ien(s) for file #8972.1 (CAPMAN ROUTINE STATS). If more
137 ; than one Ien then each will be seperated by a comma.
138 ; Example: KMPDIENS="12,98,38,123"
139 ;
140 ; KMPDRES() Results up-arrow (^) delimited in format:
141 ; Piece 1 - Name..................(field .01)
142 ; Piece 4 - CPU Time..............(field #.04)
143 ; Piece 5 - DIO References........(field #.05)
144 ; Piece 6 - BIO References........(field #.06)
145 ; Piece 7 - Page Faults...........(field #.07)
146 ; Piece 8 - M commands/Lines......(field #.08)
147 ; Piece 9 - Global References.....(field #.09)
148 ; Piece 10 - Count.................(field #.1)
149 ; Piece 14 - Ave CPU Time..........(field #99.04 - computed)
150 ; Piece 15 - Ave DIO References....(field #99.05 - computed)
151 ; Piece 16 - Ave BIO References....(field #99.06 - computed)
152 ; Piece 17 - Ave Page Faults.......(field #99.07 - computed)
153 ; Piece 18 - Ave M Commands/Lines..(field #99.08 - computed)
154 ; Piece 19 - Ave Global References.(field #99.09 - computed)
155 ;-----------------------------------------------------------------------
156 ;
157 K KMPDRES
158 I $G(KMPDIENS)="" S KMPDRES(0)="[IEN data not defined]" Q
159 ;
160 N DATA,I,IEN,J,LN
161 ;
162 S IEN="",(I,LN)=0
163 F I=1:1 S IEN=$P(KMPDIENS,",",I) Q:'IEN D
164 .Q:'$D(^KMPD(8972.1,IEN,0)) S DATA=^(0)
165 .; put second piece (date/time entered) in external format
166 .S $P(DATA,U,2)=$$FMTE^XLFDT($P(DATA,U,2))
167 .S KMPDRES(LN)=DATA
168 .; computed fields
169 .F J=4:1:9 S $P(KMPDRES(LN),U,(J+10))=$$GET1^DIQ(8972.1,IEN,(99+(.01*J)))
170 .S LN=LN+1
171 ;
172 S:'$D(KMPDRES) KMPDRES(0)="<No Data to Report>"
173 ;
174 Q
Note: See TracBrowser for help on using the repository browser.