source: WorldVistAEHR/trunk/r/PATCH_MANAGEMNT-AAQ/AAQFILE.m@ 1284

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1AAQFILE ;FGO/JHS;Find/Delete File in Directory ; 11/26/05 9:50pm
2 ;;1.0;AAQ LOCAL;;09-02-98;For Kernel V8.0 and NT-Cache
3 I ^%ZOSF("OS")'["OpenM-NT" W $C(7),!,"This routine should be run only on Alpha OpenM-NT systems! Halting.",! H 1 Q
4 I '$D(DTIME) W !,"DTIME is not set. Calling XUP to set up required variables.",!,"Press RETURN at the Select OPTION NAME: prompt.",!! D ^XUP
5 W !!,"Find/Delete File in PATCHES or ANONYMOUS Directory on NT-Cache system.",!,"This will find or delete one file at a time, not wild card selections."
6 D UCI^%ZOSV S X=$$NOW^XLFDT W !!,^DD("SITE")," ",Y," ",$$FMTE^XLFDT(X)
7PAT ; Check if default directory is PATCHES instead of ANONYMOUS.
8 I Y="TST,ROU" S AAQDIR="Y:\PATCHES\" G CKP
9 ;;I Y="VAH,ROU" S AAQDIR="T:\PATCHES\" G CKP
10 I Y="EHR,EHR" S AAQDIR="C:\PATCHES\" G CKP
11 G CKUCI
12 ; Valid directory check is done by trying to open TEST.TMP file.
13CKP K POP D OPEN^%ZISH("TEST",AAQDIR,"TEST.TMP","W")
14 G:POP=1 ANON
15 D CLOSE^%ZISH("TEST"),DELTMP G WRDIR
16ANON ; Initial setup by Avanti Team established following directories.
17 I Y="TST,ROU" S AAQDIR="Y:\ANONYMOUS\" G CKA
18 I Y="VAH,ROU" S AAQDIR="T:\ANONYMOUS\" G CKA
19CKA K POP D OPEN^%ZISH("TEST",AAQDIR,"TEST.TMP","W")
20 G:POP=1 NODEF
21 D CLOSE^%ZISH("TEST"),DELTMP
22WRDIR W !!,"Download Directory for Patches for this Site and UCI is: ",AAQDIR
23ASKOK S %=1 W !,"Is this the correct directory" D YN^DICN G:%=1 ASKFN I %=0 W !!,"This routine will not work correctly if directory names are wrong."
24 G:%=1 ASKFN
25NODEF W !!,$C(7),"The PATCHES or ANONYMOUS Download Directory could not be found."
26GETDIR R !!,"Enter the Drive:\Directory\ to use for this system: ",AAQDIR:DTIME
27 I (AAQDIR="?")!(AAQDIR="") W !!,"Enter in the format Drive:\Directory\ or '^' to Exit." G GETDIR
28 I AAQDIR["^" G NODIR
29 S AAQLN=$L(AAQDIR) I $E(AAQDIR,AAQLN)'="\" W !!,$C(7),"The entry must include the trailing backslash." G GETDIR
30 K POP D OPEN^%ZISH("TEST",AAQDIR,"TEST.TMP","W")
31 W:POP=1 !!,$C(7),"ERROR: Directory Location could not be found, try again."
32 G:POP=1 GETDIR
33 D CLOSE^%ZISH("TEST"),DELTMP
34ASKFN W !!,"Download Directory has been selected. Enter partial Filename now."
35 W !,"NOTE: Using *.* with the Filename will NOT work for lookup."
36ASKFIL W !!,"Enter a portion of the Filename or press RETURN to Exit: " R AAQFN:DTIME I (AAQFN="")!(AAQFN="^") G EXIT
37 I AAQFN[" " W $C(7),!!,"A <SPACE> cannot be used as part of the File Name.",! G ASKFIL
38 I AAQFN["?" W $C(7),!!,"Enter only Letters, Numbers, and Underscore.",! G ASKFIL
39 I (AAQFN[".G*")!(AAQFN[".K*") G SETFILE
40 I (AAQFN[".g*")!(AAQFN[".k*") G SETFILE
41 I (AAQFN["*")!(AAQFN[".") D NOEXT G ASKFIL
42 G SETWILD
43NOEXT W $C(7),!!,"RULE: Do NOT use an extension or a '*' wild card in the File Name.",!,?7,"The characters *.* are automatically included with the name."
44 W !!,"EXCEPTION: When GBL and KID files have the same name,",!,?12,"Use FILENAME.G* and FILENAME.K* for lookup." Q
45SETWILD S AAQFN=AAQFN_"*.*"
46SETFILE S AAQFILE=$ZSEARCH(AAQDIR_AAQFN) W !,"File found: " I AAQFILE="" W $C(7),"None. Try again." H 1 G ASKFIL
47 W AAQFILE
48ASKCOR S %=1 W !!,"Is this the correct filename" D YN^DICN I (%=0)!(%=2) W !!,"If the wrong file was found, use more characters for partial name lookup."
49 G:%=2 ASKDIR G:%=0 ASKFIL
50CKVMS G:AAQFILE'[";" ASKDEL
51 S AAQREN=$P(AAQFILE,";"),AAQREN=$P(AAQREN,AAQDIR,2) W $C(7),!!,"The File Name contains a trailing VMS Version number.",!,"File "_AAQFILE_" should be Renamed "_AAQREN S:AAQFILE[".*" AAQWILD=$P(AAQFILE,".")_".*"
52 S AAQWILD=AAQDIR_AAQFN
53ASKREN S %=1 W !,"Do you want to Rename this file" D YN^DICN G:%=1 REN I %=0 W !!,"Answer 'Y' to Rename. Answer 'N' skip Rename." G ASKREN
54 S AAQFILE=$P(AAQFILE,".")_".*" G ASKDEL ;VMS name won't delete
55REN S X=$ZF(-1,"REN "_AAQWILD_" "_AAQREN),AAQFILE=$ZSEARCH(AAQWILD) I AAQFILE[";" W $C(7),!!,"The File "_AAQFILE_" did not get renamed. Try again." G ASKFN
56 W !,"File has been Renamed "_AAQFILE,!,"Use lookup again if you want to delete." G EXIT
57ASKDEL S %=2 W !!,"Do you want to delete the selected file" D YN^DICN G:%=1 DEL I %=0 W !!,"Answer 'Y' to delete file(s), answer 'N' to Exit."
58 G EXIT
59DEL S X=$ZF(-1,"DEL "_AAQFILE),AAQFILE=$ZSEARCH(AAQDIR_AAQFN) I AAQFILE="" W !,"File has been deleted!" G:AAQFILE="" EXIT
60 W !,"One file deleted. There are more "_AAQFN_" files in the directory." G SETFILE
61DELTMP S AAQFILE="TEST.TMP",FILESPEC(AAQFILE)="",Y=$$DEL^%ZISH(AAQDIR,$NA(FILESPEC)) Q
62ASKDIR S %=2 W !!,"Do you want to see a Listing of files in this directory" D YN^DICN G:%=1 ASKFS I (%=0)!(%=2) W !!,"Enter a 'wildcard' file specification using a FILESPEC* format."
63 G:%=0 ASKDIR G:%=2 ASKFIL G:%=-1 EXIT
64ASKFS W !!,"Enter a 'wildcard' file specification using a FILESPEC* format: " R AAQFS:DTIME I (AAQFS="")!(AAQFS="^") G EXIT
65 I AAQFS[" " W $C(7),!!,"A <SPACE> cannot be used as part of the File Name.",! G ASKFS
66 I AAQFS["?" W $C(7),!!,"Enter an alphanumeric string with a trailing asterisk.",! G ASKFS
67 K AAQFSPEC,AAQLIST S AAQFSPEC(AAQFS)="",Y=$$LIST^%ZISH(AAQDIR,"AAQFSPEC","AAQLIST")
68 W ! S AAQ=0 F J=0:0 S AAQ=$O(AAQLIST(AAQ)) W !,AAQ Q:AAQ=""
69 G ASKFIL
70NODIR W !!,$C(7),"PATCHES or ANONYMOUS Directory will not be used now." S AAQFN=""
71CKUCI W !!,"Check the routine AAQFILE at Line Tags PAT and ANON",!,"for the appropriate UCI and Directory information. Halting.",!
72EXIT K %,%Y,AAQ,AAQDIR,AAQEXT,AAQFS,AAQFSPEC,AAQLIST,AAQLN,AAQREN,AAQWILD,FILESPEC,J,POP,X,Y
73 Q ;AAQFILE and AAQFN are killed in XPDZPAT or option Exit Action
Note: See TracBrowser for help on using the repository browser.