source: cprs/branches/tmg-cprs/m_files/TMGPAT4.m@ 1695

Last change on this file since 1695 was 796, checked in by Kevin Toppenberg, 14 years ago

Initial upload

File size: 22.2 KB
RevLine 
[796]1TMGPAT4 ;TMG/kst/Patching tools ;09/22/08
2 ;;1.0;TMG-LIB;**1**;09/22/08
3 ;
4 ;"Kevin Toppenberg MD
5 ;"GNU General Public License (GPL) applies
6 ;"9/26/08
7
8 ;"=======================================================================
9 ;" API -- Public Functions.
10 ;"=======================================================================
11 ;"Analyze(Info,Option) -- look at a patch TXT file and extract useful information
12 ;"ShowAnalysis(Info,Msg) -- display to user analysis info in a meaningful way.
13
14 ;"=======================================================================
15 ;"Private Functions
16 ;"=======================================================================
17 ;"GetReqPatches(Array,Info) -- scan Array, holding TXT file, and assemble list of required patches
18 ;"GetCategory(Array,Info) -- scan Array, holding TXT file, and assemble category entries
19 ;"GetFNames(Array,Info) -- scan Array, holding TXT file, and scavenge and .KID file names
20 ;"GetMultPatches(Array,Info,Option) -- scan Array, holding TXT file, and matching multi-patch info
21 ;"GetSeq(PatchName,Mode,Option,URL) -- For a given patch (e.g. DI*12*123), return the SEQ #
22 ;"FindMultPatch(PatchName,PckInit,Option,URL) --
23 ;"CheckDelta(Info) -- compare the requirements in Info vs existing system.
24 ;"PAnalyze(Info,Option) -- look at a patch KID file and extract useful information
25 ;"PGetReqPatches(Array,Info) -- scan Array, holding KID file, and assemble list of required patches
26 ;"CheckLocal(pArray,Option) -- check a KIDS for conflict with local modifications.
27 ;"Chk1Routine(routine) -- see if one routine has any local modifications.
28
29 ;"=======================================================================
30
31Analyze(Info,Option)
32 ;"Purpose: To look at a patch TXT file and extract useful information
33 ;"Input: Info -- PASS BY REFERENCE, and IN and OUT PARAMETER.
34 ;" Input: Info("PATH") -- path on HFS of TXT file
35 ;" Info("TEXT FILE") -- filename on HFS of TXT file
36 ;" Output:
37 ;" Info("SPECIFIED REQ",PatchName)=""
38 ;" Info("SPECIFIED REQ",PatchName)=""
39 ;" Info("MULTI-PATCH","FILENAME")=FileName
40 ;" Info("MULTI-PATCH","CONTAINS",PatchName)=""
41 ;" Info("MULTI-PATCH","CONTAINS",patchName,"LATEST IN THIS PACKAGE")=lastPatch
42 ;" Option -- optional. Pass by reference.
43 ;" Option("VERBOSE")=1, means messaages also written directly to output
44 ;"
45 ;"Results: none
46
47 new FPath,FName,Array
48 set FPath=$get(Info("PATH")) if FPath="" goto ADone
49 set FName=$get(Info("TEXT FILE")) if FName="" goto ADone
50 if $$FTG^%ZISH(FPath,FName,"Array(0)",1)=0 goto ADone
51 do GetReqPatches(.Array,.Info)
52 do GetCategory(.Array,.Info)
53 do GetMultPatches(.Array,.Info,.Option)
54 do GetFNames(.Array,.Info)
55 do GetSubject(.Array,.Info)
56 do CheckDelta(.Info)
57ADone quit
58
59
60PAnalyze(Info,Option)
61 ;"Purpose: To look at a patch KID file and extract useful information
62 ;"Input: Info -- PASS BY REFERENCE, and IN and OUT PARAMETER.
63 ;" Input: Info("PATH") -- path on HFS of TXT file
64 ;" Info("KID FILE") -- filename on HFS of KID file
65 ;" Output: Info("SPECIFIED REQ",PatchName)=""
66 ;" Info("SPECIFIED REQ",PatchName)=""
67 ;" Option -- optional. Pass by reference.
68 ;" Option("VERBOSE")=1, means messaages also written directly to output
69 ;"Results: none
70
71 new FPath,FName,Array
72 set FPath=$get(Info("PATH")) if FPath="" goto PADone
73 set FName=$get(Info("KID FILE")) if FName="" goto PADone
74 if $$FTG^%ZISH(FPath,FName,"Array(0)",1)=0 goto PADone
75 do PGetReqPatches(.Array,.Info)
76 ;"do PCheckDelta(.Info)
77PADone quit
78
79
80GetReqPatches(Array,Info)
81 ;"Purpose: to scan Array, holding TXT file, and assemble list of required patches
82 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
83 ;" Info -- PASS BY REFERENCE. Data added as follows:
84 ;" Info("SPECIFIED REQ",PatchName)=""
85 ;"Results: none
86
87 new done set done=0
88 new foundList set foundList=0
89 new i set i=""
90 for set i=$order(Array(i)) quit:(i="")!done do
91 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
92 . set s=$$STRIP^XLFSTR(s,$char(10))
93 . set s=$$STRIP^XLFSTR(s,$char(13))
94 . if (foundList=1)&(s="") set done=1 quit
95 . if s["Associated patches:" set foundList=1
96 . if foundList do
97 . . new onePatch
98 . . set onePatch=$$TRIM^XLFSTR($piece($piece(s,")",2)," ",1)) ;"e.g. (v)PX*1*29 <<= must be installed BEFORE `PX*1*121'
99 . . if onePatch="" quit
100 . . set Info("SPECIFIED REQ",onePatch)=""
101 quit
102
103PGetReqPatches(Array,Info)
104 ;"Purpose: to scan Array, holding KID file, and assemble list of required patches
105 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
106 ;" Info -- PASS BY REFERENCE. Data added as follows:
107 ;" Info("SPECIFIED REQ",PatchName)=""
108 ;"Results: none
109 ;
110 new done set done=0
111 new foundList set foundList=0
112 new i set i=""
113 for set i=$order(Array(i)) quit:(i="")!done do
114 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
115 . set s=$$STRIP^XLFSTR(s,$char(10))
116 . set s=$$STRIP^XLFSTR(s,$char(13))
117 . if s'["REQB" quit
118 . if (s["""REQB"",""B""")!(s["""REQB"",0") quit
119 . set i=$order(Array(i)) quit:(i="")
120 . new onePatch set onePatch=$piece($get(Array(i)),"^",1) quit:(onePatch="")
121 . set Info("SPECIFIED REQ",onePatch)=""
122 quit
123
124GetCategory(Array,Info)
125 ;"Purpose: to scan Array, holding TXT file, and assemble category entries
126 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
127 ;" Info -- PASS BY REFERENCE. Data added as follows:
128 ;" Info("PATCH CATEGORY",name)=""
129 ;"Results: none
130
131 new done set done=0
132 new foundList set foundList=0
133 new i set i=""
134 for set i=$order(Array(i)) quit:(i="")!done do
135 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
136 . set s=$$STRIP^XLFSTR(s,$char(10))
137 . set s=$$STRIP^XLFSTR(s,$char(13))
138 . if (foundList=1)&(s="") set done=1 quit
139 . if s["Category:" set foundList=1
140 . if foundList do
141 . . new onePatch
142 . . set onePatch=$$TRIM^XLFSTR($piece(s,"-",2)) ;"e.g. - Routine
143 . . if onePatch="" quit
144 . . set Info("PATCH CATEGORY",onePatch)=""
145 quit
146
147GetFNames(Array,Info)
148 ;"Purpose: to scan Array, holding TXT file, and scavenge and .KID file names
149 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
150 ;" Info -- PASS BY REFERENCE. Data added as follows:
151 ;" Info("MISC KID FILES",name)=""
152 ;"Results: none
153
154 new i set i=""
155 for set i=$order(Array(i)) quit:(i="") do
156 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
157 . set s=$$STRIP^XLFSTR(s,$char(10))
158 . set s=$$STRIP^XLFSTR(s,$char(13))
159 . if $$UP^XLFSTR(s)[".KID" do ;"NOTE: this system will only get 1 filename per line...
160 . . new kidS
161 . . if s[".kid" set kidS=".kid"
162 . . else set kidS=".KID"
163 . . if $piece(s,kidS,1)="" quit
164 . . new FName set FName=$$GetWord^TMGSTUTL(s,$find(s,kidS)-1," "," ")
165 . . if $extract(FName,$length(FName))="." set FName=$$TRIM^XLFSTR(FName,"R",".")
166 . . if (FName="") quit
167 . . set Info("MISC KID FILES",FName)=""
168 quit
169
170GetSubject(Array,Info)
171 ;"Purpose: to scan Array, holding TXT file, and scavenge SUBJECT line
172 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
173 ;" Info -- PASS BY REFERENCE. Data added as follows:
174 ;" Info("SUBJECT",name)=""
175 ;"Results: none
176
177 new i set i=""
178 new done set done=0
179 for set i=$order(Array(i)) quit:(i="")!done do
180 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
181 . set s=$$STRIP^XLFSTR(s,$char(10))
182 . set s=$$STRIP^XLFSTR(s,$char(13))
183 . if s["Subject:" do
184 . . new subj set subj=$piece(s,"Subject:",2)
185 . . if subj="" quit
186 . . set Info("SUBJECT",subj)=""
187 . . set done=1
188 quit
189
190GetMultPatches(Array,Info,Option)
191 ;"Purpose: to scan Array, holding TXT file, and matching multi-patch info
192 ;"Input: Array -- PASS BY REFERENCE -- holds TXT file
193 ;" Info -- PASS BY REFERENCE. Data added as follows:
194 ;" Info("MULTI-PATCH","FILENAME")=FileName
195 ;" Info("MULTI-PATCH","CONTAINS",PatchName)=""
196 ;" Option -- optional. Pass by reference.
197 ;" Option("VERBOSE")=1, means messaages also written directly to output
198 ;"Results: none
199
200 new done set done=0
201 new foundList,foundSection set (foundList,foundSection)=0
202 new fileName set fileName=""
203 new i set i=""
204 for set i=$order(Array(i)) quit:(i="")!done do
205 . new s set s=$$TRIM^XLFSTR($get(Array(i)))
206 . if (foundList=1)&(s="") set done=1 quit
207 . if s["SOFTWARE AND DOCUMENTATION RETRIEVAL" do
208 . . set foundSection=1
209 . if foundList do quit
210 . . if s["---" quit
211 . . if s="" set done=1 quit
212 . . new tempS set tempS=$$TRIM^XLFSTR(s)
213 . . new onePatch
214 . . set onePatch=$$GetWord^TMGSTUTL(tempS,$length(tempS)-1)
215 . . if onePatch="" quit
216 . . new tempName set tempName=$$GetSeq(onePatch,1)
217 . . if tempName="" set onePatch=onePatch_" SEQ #???"
218 . . else set onePatch=tempName
219 . . set Info("MULTI-PATCH","CONTAINS",onePatch)=""
220 . if foundSection do
221 . . if s["Patch(es)" set foundList=1 quit
222 . . new tempS set tempS=$$UP^XLFSTR(s)
223 . . if tempS[".KID" do
224 . . . new p set p=$find(tempS,".KID")-1
225 . . . set tempS=$$GetWord^TMGSTUTL(s,p) quit:tempS=""
226 . . . for quit:($$UP^XLFSTR($e(tempS,$length(tempS)))="D")!(tempS="") do
227 . . . . set tempS=$e(tempS,1,$length(tempS)-1)
228 . . . set Info("MULTI-PATCH","FILENAME")=tempS
229
230 quit
231
232
233GetSeq(PatchName,Mode,Option,URL)
234 ;"Purpose: For a given patch (e.g. DI*12*123), return name with the SEQ #
235 ;"Input: PatchName -- e.g. DI*12*123
236 ;" Mode -- OPTIONAL (0 is default) -- 0: search .KID & .TXT; 1: search .TXT files only, 2: search .KID only
237 ;" Option -- optional. Pass by reference.
238 ;" Option("VERBOSE")=1, means messaages also written directly to output
239 ;" URL -- PASS BY REFERENCE, an OUT PARAMETER
240 ;"Output: in addition to OUT PARAMETERS, the following global variables are set:
241 ;" set ^TMG("KIDS","PATCH NAMES",PckInit,Ver,PatchNum,oneSeqNum)=""
242 ;" set ^TMG("KIDS","PATCH NAMES",PckInit,"COMBINED",result)=URL
243 ;"Results: returns patch name with seq #, e.g. 'DI*12*123 SEQ #123'
244 ;" or "" if problem.
245
246 new result set result=""
247 new PckInit,Ver,PatchNum
248 set PatchName=$get(PatchName)
249 set PckInit=$piece(PatchName,"*",1)
250 set Ver=$piece(PatchName,"*",2)
251 set PatchNum=$piece(PatchName,"*",3)
252 if (PckInit="")!(Ver="")!(PatchNum="") goto GSqDone
253 set result=$get(^TMG("KIDS","PATCH NAMES",PckInit,Ver,PatchNum)) ;"stored from prior search
254 if result'="" do goto GSqDone
255 . if result="???" set result="" quit
256 . set URL=$get(^TMG("KIDS","PATCH NAMES",PckInit,"COMBINED",result))
257
258 new verbose set verbose=$get(Option("VERBOSE"))
259 set Mode=+$get(Mode)
260
261 new FPath,FName,Array,abort
262 set abort=0
263 set FPath=$get(^TMG("KIDS","PATCH DIR"),"/tmp/")
264 set FName="ftp.va.gov-dirFor-"_PckInit
265 if '$$FileExists^TMGIOUTL(FPath_FName) do
266 . if verbose do
267 . . write "Finding Sequence # for ",PatchName,!
268 . . write "Getting directory information from VA ftp server..."
269 . if $$GetPckList^TMGKERNL(PckInit,.Array,1)=0 set abort=1
270 . if verbose write " Done.",!
271 else do
272 . if $$FTG^%ZISH(FPath,FName,"Array(0)",1)=0 set abort=1 quit
273 if abort goto GSqDone
274
275 new found set found=0
276 new i set i=0 ;"skip first line, a header line
277 for set i=$order(Array(i)) quit:(i="")!found do
278 . new Name,Path,FullNamePath,oneVer,onePatchNum,oneSeqNum
279 . set FullNamePath=$get(Array(i)) quit:FullNamePath=""
280 . do SplitFNamePath^TMGIOUTL(FullNamePath,.Path,.Name,"/")
281 . if Name="" quit
282 . new tempName set tempName=$$UP^XLFSTR(Name)
283 . if Mode=0,(tempName'[".TXT")&((tempName'[".KID")) quit
284 . else if Mode=1,(tempName'[".TXT") quit
285 . else if Mode=2,(tempName'[".KID") quit
286 . set oneVer=$piece($piece(tempName,"_",1),"-",2) quit:(oneVer="")
287 . if oneVer?.N1"P".N set oneVer=$translate(Ver,"P",".")
288 . set oneSeqNum=$piece($piece(tempName,"_",2),"-",2) quit:(oneSeqNum="")
289 . set onePatchNum=$piece($piece(tempName,"_",3),"-",2) quit:(onePatchNum="")
290 . set onePatchNum=$piece(onePatchNum,".",1) quit:(onePatchNum="")
291 . if onePatchNum=PatchNum do
292 . . set result=PatchName_" SEQ #"_oneSeqNum
293 . . set URL=FullNamePath
294 . . set found=1
295 . . set ^TMG("KIDS","PATCH NAMES",PckInit,Ver,PatchNum)=result
296 . . set ^TMG("KIDS","PATCH NAMES",PckInit,"COMBINED",result)=URL
297
298GSqDone
299 if result="" do
300 . if (PckInit="")!(Ver="")!(PatchNum="") quit
301 . set ^TMG("KIDS","PATCH NAMES",PckInit,Ver,PatchNum)="???"
302
303 quit result
304
305
306FindMultPatch(PatchName,PckInit,Option,URL,Info)
307 ;"Purpose: Search through downloaded directory file for patch, and return URL
308 ;"Input: PatchName -- e.g. CSV_12_1234.KID
309 ;" PckInit -- the initials for the package.
310 ;" Option -- optional. Pass by reference.
311 ;" Option("VERBOSE")=1, means messaages also written directly to output
312 ;" URL -- PASS BY REFERENCE, an OUT PARAMETER
313 ;" Info -- PASS BY REFERENCE
314 ;" Info("KID URL")=URL on server for KID file
315 ;" Info("TEXT URL")=URL on server for TXT file
316 ;"Results: 1 if found, 0 if not found or problem.
317
318 new result set result=0
319 set PatchName=$get(PatchName) goto:(PatchName="") FMPDone
320 new verbose set verbose=$get(Option("VERBOSE"))
321
322 new FPath,FName,Array,abort
323 set abort=0
324 set FPath=$get(^TMG("KIDS","PATCH DIR"),"/tmp/")
325 set FName="ftp.va.gov-dirFor-"_PckInit
326 if '$$FileExists^TMGIOUTL(FPath_FName) do
327 . if verbose do
328 . . write "Finding Patch: ",PatchName,!
329 . . write "Getting directory information from VA ftp server..."
330 . if $$GetPckList^TMGKERNL(PckInit,.Array,1)=0 set abort=1
331 . if verbose write " Done.",!
332 else do
333 . if $$FTG^%ZISH(FPath,FName,"Array(0)",1)=0 set abort=1 quit
334 if abort goto FMPDone
335
336 new i set i=0 ;"skip first line, a header line
337 for set i=$order(Array(i)) quit:(i="")!(result=1) do
338 . new Name,Path,FullNamePath,tempName
339 . set FullNamePath=$get(Array(i)) quit:FullNamePath=""
340 . do SplitFNamePath^TMGIOUTL(FullNamePath,.Path,.Name,"/")
341 . if Name="" quit
342 . if $$UP^XLFSTR(Name)=$$UP^XLFSTR(PatchName) do
343 . . set URL=FullNamePath
344 . . set result=1
345
346 if result=0 do ;"last try to come up with filename.
347 . new serverPath set serverPath=$get(Info("KID URL"))
348 . if serverPath="" set serverPath=$get(Info("TEXT URL"))
349 . set serverPath=$$PathExtract^TMGIOUTL(serverPath)
350 . set serverPath=$piece(serverPath,"ftp://",2)
351 . set URL=serverPath_PatchName
352 . set result=1 ;"this is not a sure 'find', more of a hopeful guess that it will be in same directory.
353
354FMPDone
355 quit result
356
357
358
359CheckDelta(Info)
360 ;"Purpose: to compare the requirements in Info (as created by Analyze) and
361 ;" determine differences in existing system.
362 ;"Input: Info. PASS BY REFERENCE
363 ;" Info("PATH") -- path on HFS of TXT file
364 ;" Info("TEXT FILE") -- filename on HFS of TXT file
365 ;" Info("SPECIFIED REQ",PatchName)=""
366 ;" Info("MULTI-PATCH","FILENAME")=FileName
367 ;" Info("MULTI-PATCH","CONTAINS",PatchName)=""
368 ;" Info("MULTI-PATCH","CONTAINS",patchName,"LATEST IN THIS PACKAGE")=lastPatch
369 ;"Output:
370 ;" Info("SPECIFIED REQ",PatchName)="OK, Installed." or "Still Needed"
371 ;" Info("STILL NEEDED",reqPatch)=""
372
373 new reqPatch set reqPatch=""
374 for set reqPatch=$order(Info("SPECIFIED REQ",reqPatch)) quit:(reqPatch="") do
375 . new tempS
376 . if $$IsInstalled^TMGPAT2(reqPatch) set tempS="OK, Installed."
377 . else do
378 . . set tempS="Still Needed."
379 . . new s2 set s2=$$GetSeq(reqPatch) if s2="" set s2=reqPatch
380 . . set Info("STILL NEEDED",s2)=""
381 . set Info("SPECIFIED REQ",reqPatch)=tempS
382
383 new patchName set patchName=""
384 for set patchName=$order(Info("MULTI-PATCH","CONTAINS",patchName)) quit:(patchName="") do
385 . new PckInit set PckInit=$piece(patchName,"*",1)
386 . new Ver set Ver=$piece(patchName,"*",2)
387 . set patchNum=$piece($piece(patchName,"*",3)," ",1)
388 . new seqNum set seqNum=$piece(patchName,"SEQ #",2)
389 . if (PckInit="")!(Ver="")!(patchNum="") quit
390 . new lastPatch set lastPatch=$$GetLastPackage^TMGPAT1(PckInit,Ver) ;"returns e.g. 'DI*22.0*140 SEQ# 123'
391 . set Info("MULTI-PATCH","CONTAINS",patchName,"LATEST IN THIS PACKAGE")=lastPatch
392 . new lastSeqNum set lastSeqNum=$piece(lastPatch,"SEQ #",2)
393 . if lastSeqNum<seqNum do
394 . . set Info("GAPPED PATCHES",patchName)="Currently at: "_lastPatch
395
396 quit
397
398ShowAnalysis(Info,Msg)
399 ;"Purpose: To display analysis info in a meaningful way.
400 ;"Input: Info -- PASS BY REFERENCE. Info as created by Analyze(Info,Option)
401 ;" Msg -- PASS BY REFERANCE, an OUT PARAMETER
402 ;" Errors are stored in Msg("ERROR",x)=Message
403 ;" Msg("ERROR")=count of last error
404 ;" Message are store in Msg(x)=Message
405 ;" Msg=count of last message+1
406
407 new tempMsg,someReq
408 merge tempMsg=Msg
409 set someReq=0
410 do AddMsg^TMGPAT2("According to Info TXT file,",0,.tempMsg)
411 do AddMsg^TMGPAT2("Before this patch is applied, other patches should have been installed first:",0,.tempMsg)
412 new i set i=""
413 for set i=$order(Info("SPECIFIED REQ",i)) quit:(i="") do
414 . new s set s=$$GetSeq(i) if s="" set s=i
415 . set s=$$LJ^XLFSTR(s,25)
416 . set someReq=1
417 . new PckInit set PckInit=$piece(s,"*",1)
418 . new Ver set Ver=$piece(s,"*",2)
419 . new LastPck set LastPck=$$GetLastPackage^TMGPAT1(PckInit,Ver)
420 . new tempS set tempS=" "_s_" <-- "_$get(Info("SPECIFIED REQ",i))
421 . if LastPck'="" set tempS=tempS_" Current at: "_LastPck
422 . do AddMsg^TMGPAT2(tempS,0,.tempMsg)
423 do AddMsg^TMGPAT2(" ",0,.tempMsg)
424 if someReq=1 do
425 . kill Msg merge Msg=tempMsg
426
427 if $get(Info("MULTI-PATCH","FILENAME"))="" goto SA2
428 set someReq=0
429 do AddMsg^TMGPAT2("This patch is a Multi-Patch. It contains patches for the following packages: ",0,.Msg)
430 kill tempMsg merge tempMsg=Msg
431 set i=""
432 for set i=$order(Info("MULTI-PATCH","CONTAINS",i)) quit:(i="") do
433 . new curSys set curSys=$get(Info("MULTI-PATCH","CONTAINS",i,"LATEST IN THIS PACKAGE"))
434 . new s set s=$$LJ^XLFSTR(i,25)
435 . set someReq=1
436 . do AddMsg^TMGPAT2(" "_s_" [This system is currently at: "_curSys_"]",0,.tempMsg)
437 if someReq=1 do
438 . kill Msg merge Msg=tempMsg
439 do AddMsg^TMGPAT2("This multipatch is combined into file: "_$get(Info("MULTI-PATCH","FILENAME")),0,.Msg)
440SA2
441 new subj set subj=$order(Info("SUBJECT",""))
442 if subj'="" do
443 . do AddMsg^TMGPAT2("PATCH SUBJECT: "_subj,0,.Msg)
444
445SADone
446 quit
447
448
449CheckLocal(pArray,Option)
450 ;"Purpose: to check a KIDS installation file, before it is applied, to ensure
451 ;" that it doesn't conflict with any local modifications.
452 ;" --The means of detecting local mods to be enhanced with time.
453 ;"Input -- pArray -- PASS BY NAME. This should be a reference to ^XTMP("XPDI",XPDA,
454 ;" for the installation being considered. Thus is should have this format:
455 ;" @pArray@("BLD")
456 ;" @pArray@("MBREQ")
457 ;" @pArray@("PKG")
458 ;" @pArray@("QUES")
459 ;" @pArray@("RTN",RoutineName) <--- the key part
460 ;" Option -- PASS BY REFERENCE
461 ;" Option("VERBOSE")=1 Optional, 1=show output
462 ;"Results: 1 if conflict, 0 if OK.
463 new result set result=0
464 new routine set routine=""
465 for set routine=$order(@pArray@("RTN",routine)) quit:(routine="") do
466 . if $$Chk1Routine(routine)=1 do
467 . . set result=1
468 . . if $get(Option("VERBOSE"))=1 write "WARNING: Importing routine ",routine," will overwrite local changes!",!
469 quit result
470
471
472Chk1Routine(routine)
473 ;"Purpose: to see if one routine has any local modifications.
474 ;"Input: routine -- the routine name e.g. XUP
475 ;"Results: 1 if conflict, 0 if OK.
476 ;"NOTE: for now, the only test to be used will be the presence of the
477 ;" text '//kt'
478 ;" Later I want to use TMG VISTA FILE INFO, file 22708
479
480 new result set result=0
481
482 new line set line=0
483 new blankCt set blankCt=0
484 for do quit:(blankCt>10)!result
485 . new ref set ref="+"_line_"^"_routine
486 . new s set s=$TEXT(@ref)
487 . if s="" set blankCt=blankCt+1
488 . set result=(s["//kt")
489 . set line=line+1
490 quit result
Note: See TracBrowser for help on using the repository browser.