source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCCVU1.m@ 1595

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

initial load of FOIAVistA 6/30/08 version

File size: 5.4 KB
Line 
1SCCVU1 ;ALB/RMO,TMP - SCHED VISITS CONVERT/ARCHIVE UTILITIES; [ 10/10/95 2:39 PM ]
2 ;;5.3;Scheduling;**211**;Aug 13, 1993
3 ;
4CHKDT(SCRESULT,SC,SCCVTYP) ; -- Check date range
5 ; Input -- SC Array:
6 ; SC("STARTDT") Start date
7 ; ("ENDDT") End date
8 ; -- SCCVTYP "CST" for convert function
9 ; "AST" for archive function
10 ; Output -- SCRESULT (#=Error number | 0=No Error)^Message
11 ;
12 N SCENDT,SCERRMSG,SCERRNB,SCSTDT
13 ;
14 S SCERRNB=0
15 ;
16 S SCSTDT=$G(SC("STARTDT"))
17 S SCENDT=$G(SC("ENDDT"))
18 ;
19 ;Check if start date or end date not defined
20 I 'SCSTDT,'SCENDT D
21 . S SCERRNB=4049006.005
22 . D GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
23 ;
24 ;Verify date range
25 I 'SCERRNB S SCERRNB=$$VERDT^SCCVU2(SCSTDT,SCENDT,"",.SCERRMSG)
26 ;
27 S SCRESULT=SCERRNB
28 I SCERRNB S SCRESULT=SCRESULT_U_$$BLDSTR(.SCERRMSG)
29 ;
30CHKDTQ Q
31 ;
32CHKDUP(SCRESULT,SC,SCCVT) ; -- Check duplicate log entries
33 ; Input -- SC Array:
34 ; SC("TYPE") Conversion type
35 ; ("STARTDT") Start date
36 ; ("ENDDT") End date
37 ; ("TEMPLNO") Template number ien
38 ; -- SCCVT "CST" for convert function
39 ; "AST" for archive function
40 ; Output -- SCRESULT (#=Error number | 0=No Error)^Message
41 ;
42 N SCCVTYP,SCENDT,SCERRMSG,SCERRNB,SCLOG,SCSTDT
43 ;
44 S SCERRNB=0
45 ;
46 S SCCVTYP=$G(SC("TYPE"))
47 S SCSTDT=$G(SC("STARTDT"))
48 S SCENDT=$G(SC("ENDDT"))
49 S SCLOG=$G(SC("TEMPLNO"))
50 ;
51 ;Check if type, date range and Template number ien are defined
52 I 'SCCVTYP!('SCSTDT)!('SCENDT)!('SCLOG) D
53 . S SCERRNB=4049006.002
54 . D GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
55 ;
56 ;Check duplicate log entries
57 I 'SCERRNB S SCERRNB=$$CHKDUP^SCCVU2(SCCVTYP,SCSTDT,SCENDT,SCLOG,.SCERRMSG)
58 ;
59 S SCRESULT=SCERRNB
60 I SCERRNB S SCRESULT=SCRESULT_U_$$BLDSTR(.SCERRMSG)
61 ;
62CHKDUPQ Q
63 ;
64PROCREQ(SCRESULT,SC) ; -- Process conversion/estimate request
65 ; Input -- SC Array:
66 ; SC("TEMPLNO") Template number ien
67 ; ("REQNUM") Request number ien
68 ; Output -- SCRESULT (#=Error number | 0=No Error)^Message
69 ;
70 N SCERRMSG,SCERRNB,SCLOG,SCREQ,SCREQACT,SCREQEVT
71 S SCERRNB=0
72 ;
73 S SCLOG=$G(SC("TEMPLNO"))
74 S SCREQ=$G(SC("REQNUM"))
75 ;
76 ;Quit if Template number ien or request ien are not defined
77 I 'SCLOG!('SCREQ) D
78 . S SCERRNB=4049006.003
79 . D GETERR^SCCVLOG1(SCERRNB,"","","",1,.SCERRMSG)
80 ;
81 S SCRESULT=$S('SCERRNB:0,1:SCERRNB_U_$$BLDSTR(.SCERRMSG))
82 ;
83 G:SCERRNB PROCREQQ
84 ;
85 ; Set request action
86 S SCREQACT=$P($G(^SD(404.98,SCLOG,"R",SCREQ,0)),U,2)
87 S SCREQEVT=$P($G(^SD(404.98,SCLOG,"R",SCREQ,0)),U,3)
88 ;
89 ; Queue conversion request to start or re-start
90 I "^1^3^"[(U_SCREQACT_U) D
91 . D QUE^SCCVE(SCLOG,SCREQ)
92 . IF SCREQEVT D JOURNAL(SCLOG)
93 ;
94 ; Process conversion request to stop
95 I SCREQACT=2 D STOP^SCCVE(SCLOG,SCREQ)
96 ;
97PROCREQQ Q
98 ;
99TASKSTA(SCRESULT,SCLOG) ; -- Retrieve task status description
100 ; Input -- SCLOG Template number ien
101 ; Output --
102 ; SCRESULT (0^Task status description^status code or Error #^Message)
103 ;
104 N SCERRNB,SCTSKD,ZTCPU
105 ;
106 S SCERRNB=0
107 S SCTSKD="Unknown"
108 ;
109 ;Quit if Template number ien is not defined
110 I '$G(SCLOG) D G TASKSTAQ
111 . S SCERRNB=4049006.004
112 . D GETERR^SCCVLOG1(SCERRNB,"","","",0,.SCERRMSG)
113 ;
114 ;Get task status description
115 I 'SCERRNB D
116 . S ZTSK=$P($G(^SD(404.98,SCLOG,1)),U,3),ZTCPU=$P($G(^(1)),U,4)
117 . I ZTSK D
118 . . D STAT^%ZTLOAD
119 . . S SCTSKD=ZTSK(2)_U_ZTSK(1)
120 ;
121 S SCRESULT=SCERRNB_U_SCTSKD
122 ;
123TASKSTAQ Q
124 ;
125BLDSTR(E) ; -- Build error message string
126 ; Input -- E Error message array
127 ; Output -- Error message string for display purposes
128 N I,Y,STOP
129 S Y=""
130 S (I,STOP)=0
131 F S I=$O(E(I)) Q:'I D Q:STOP
132 . I ($L(Y)+$L(E(I)))<240 S Y=Y_" "_E(I) Q
133 . S STOP=1
134 Q $G(Y)
135DTOK(SC) ; -- Verify that date range is OK
136 N SCERR,SCOK
137 S SCOK=1
138 D CHKDT(.SCERR,.SC)
139 G:$G(SCERR) DTOKQ
140 S SC("TEMPLNO")=DA,SC("TYPE")=1
141 D CHKDUP(.SCERR,.SC,"CST")
142 ;
143DTOKQ ;
144 I +$G(SCERR) W !!,*7,$P(SCERR,U,2),!! S SCOK=0
145 Q SCOK
146 ;
147CNVTSCH(SCLOG) ; -- Function determines if any convert was scheduled
148 ; Returns 0 if none scheduled, 1 if any ever scheduled
149 N SCSCH,Z
150 S SCSCH=0
151 S Z=0 F S Z=$O(^SD(404.98,SCLOG,"R",Z)) Q:'Z I $P($G(^(Z,0)),U,3) S SCSCH=1 Q
152 Q SCSCH
153 ;
154JOURNAL(SCLOG) ; -- display journal message and global growth estimates
155 N DIC,DR,DIQ,DA,SCDATA,SCTOT,FLD
156 S DIC="404.98",DA=SCLOG,DR="207:211",DIQ="SCDATA",DIQ(0)="E"
157 D EN^DIQ1
158 S SCTOT=0
159 F FLD=207:1:211 S SCTOT=SCTOT+$G(SCDATA(404.98,SCLOG,FLD,"E"))
160 ;
161 W !
162 W !,">>> The estimated global growth profile for this template is the following:"
163 W !
164 W !,?10,"Global",?25,"Blocks",?40,"[Block Size: ",$$BLKSIZE^SCCVEGU1()," bytes]"
165 W !,?10,"---------",?25,"-----------"
166 W !,?10,"^SCE",?25,$J($FN($G(SCDATA(404.98,SCLOG,207,"E")),","),11)
167 W !,?10,"^AUPNVSIT",?25,$J($FN($G(SCDATA(404.98,SCLOG,208,"E")),","),11)
168 W !,?10,"^AUPNVPRV",?25,$J($FN($G(SCDATA(404.98,SCLOG,209,"E")),","),11)
169 W !,?10,"^AUPNVPOV",?25,$J($FN($G(SCDATA(404.98,SCLOG,210,"E")),","),11)
170 W !,?10,"^AUPNVCPT",?25,$J($FN($G(SCDATA(404.98,SCLOG,211,"E")),","),11)
171 W !,?10,"---------",?25,"-----------"
172 W !,?10,"Total",?25,$J($FN(SCTOT,","),11)
173 ;
174 W !
175 W !,">>> Please verify that enough global disk space and journal space"
176 W !," are available for these anticipated increases."
177 W !
178 W !,">>> Also, please verify that system backup is not scheduled to"
179 W !," run within the start and stop times of this conversion job."
180 W !
181 D PAUSE^SCCVU
182 Q
183 ;
Note: See TracBrowser for help on using the repository browser.