1 | KMPDU ;OAK/RAK - CM Tools Utility ;2/17/04 09:47
|
---|
2 | ;;2.0;CAPACITY MANAGEMENT TOOLS;**2**;Mar 22, 2002
|
---|
3 | ;
|
---|
4 | GBLCHECK(GLOBAL) ;-- extrinsic function
|
---|
5 | ;-----------------------------------------------------------------------
|
---|
6 | ; GLOBAL.. Global name to be checked. Must be either:
|
---|
7 | ; ^XTMP
|
---|
8 | ; ^TMP
|
---|
9 | ; ^UTILITY
|
---|
10 | ;
|
---|
11 | ; RESUTL: 0 - Does not pass.
|
---|
12 | ; 1 - Passes.
|
---|
13 | ;-----------------------------------------------------------------------
|
---|
14 | Q:$G(GLOBAL)="" 0
|
---|
15 | N GBL,I,RESULT
|
---|
16 | S RESULT=0
|
---|
17 | S GBL=GLOBAL
|
---|
18 | ;-- remove '^'.
|
---|
19 | S GBL=$E(GBL,2,$L(GBL))
|
---|
20 | ;-- remove '('.
|
---|
21 | S GBL=$P(GBL,"(")
|
---|
22 | F I="XTMP","TMP","UTILITY" I GBL=I S RESULT=1 Q
|
---|
23 | Q RESULT
|
---|
24 | ;
|
---|
25 | FMDTI(Y,X) ;-- date/time in internal fileMan format.
|
---|
26 | ;----------------------------------------------------------------------
|
---|
27 | ; X - User response ('T', '12/12/94', etc.)
|
---|
28 | ;
|
---|
29 | ; Return: Y(0)=InternalFilemanDate
|
---|
30 | ; Y(1)=ExternalFilemanDate
|
---|
31 | ;----------------------------------------------------------------------
|
---|
32 | K Y
|
---|
33 | I $G(X)']"" S Y(0)="^" Q
|
---|
34 | N %DT,DATETIME
|
---|
35 | S %DT="ST" D ^%DT
|
---|
36 | S DATETIME=$S(Y>0:Y,1:"^")
|
---|
37 | K Y
|
---|
38 | ;-- fm internal format.
|
---|
39 | S Y(0)=DATETIME
|
---|
40 | ;-- external format.
|
---|
41 | S Y(1)=$$FMTE^XLFDT(DATETIME)
|
---|
42 | Q
|
---|
43 | ;
|
---|
44 | KILL(RESULT,VARIABLE) ;-- kill variables.
|
---|
45 | ;-----------------------------------------------------------------------
|
---|
46 | ; VARIABLE... local or global variable to be killed.
|
---|
47 | ;
|
---|
48 | ; This subroutine kills variables (local or global). It should be used
|
---|
49 | ; mostly to kill global variables that have been set when components
|
---|
50 | ; have been populated with long lists that were set into temporary
|
---|
51 | ; globals. If VARIABLE is a global variable, it must be either ^TMP or
|
---|
52 | ; ^UTILITY to be killed.
|
---|
53 | ;-----------------------------------------------------------------------
|
---|
54 | K RESULT S RESULT=""
|
---|
55 | I $G(VARIABLE)="" S RESULT="[No variable to kill]" Q
|
---|
56 | I $E(VARIABLE)="^" D Q:RESULT]""
|
---|
57 | .I '$$GBLCHECK(VARIABLE) D
|
---|
58 | ..S RESULT="[Can only kill globals ^XTMP, ^TMP or ^UTILITY]"
|
---|
59 | K @VARIABLE
|
---|
60 | S RESULT="<"_VARIABLE_" killed>"
|
---|
61 | Q
|
---|
62 | ;
|
---|
63 | TIMEADD(KMPDTM,KMPDADD) ;-- extrinsic function - add time
|
---|
64 | ;----------------------------------------------------------------------
|
---|
65 | ; KMPDTM... Current time in dy hr:mn:sc format
|
---|
66 | ; KMPDTM... Time to add to current time in dy hr:mn:sc format
|
---|
67 | ;
|
---|
68 | ; RETURN: total in dy hr:mn:sc format
|
---|
69 | ;----------------------------------------------------------------------
|
---|
70 | Q:$G(KMPDTM)="" ""
|
---|
71 | Q:$G(KMPDADD)="" KMPDTM
|
---|
72 | N DY,HR,MN,SC
|
---|
73 | ; current time
|
---|
74 | S DY(1)=+$P(KMPDTM," ")
|
---|
75 | S HR(1)=+$P($P(KMPDTM," ",2),":")
|
---|
76 | S MN(1)=+$P($P(KMPDTM," ",2),":",2)
|
---|
77 | S SC(1)=+$P($P(KMPDTM," ",2),":",3)
|
---|
78 | ; time to be added
|
---|
79 | S DY(2)=+$P(KMPDADD," ")
|
---|
80 | S HR(2)=+$P($P(KMPDADD," ",2),":")
|
---|
81 | S MN(2)=+$P($P(KMPDADD," ",2),":",2)
|
---|
82 | S SC(2)=+$P($P(KMPDADD," ",2),":",3)
|
---|
83 | ; add seconds
|
---|
84 | S SC(3)=SC(1)+SC(2)
|
---|
85 | ; if greater than 59 seconds
|
---|
86 | I SC(3)>59 S MN(3)=SC(3)\60,SC(3)=SC(3)-60
|
---|
87 | ; add minutes
|
---|
88 | S MN(3)=$G(MN(3))+MN(1)+MN(2)
|
---|
89 | ; if greater than 59 minutes
|
---|
90 | I MN(3)>59 S HR(3)=MN(3)\60,MN(3)=MN(3)-60
|
---|
91 | ; add hours
|
---|
92 | S HR(3)=$G(HR(3))+HR(1)+HR(2)
|
---|
93 | ; if greater than 23 hours
|
---|
94 | I HR(3)>23 S DY(3)=HR(3)\24,HR(3)=HR(3)-24
|
---|
95 | ; days
|
---|
96 | S DY(3)=$G(DY(3))+DY(1)+DY(2)
|
---|
97 | ;
|
---|
98 | Q DY(3)_" "_HR(3)_":"_MN(3)_":"_SC(3)
|
---|