source: WorldVistAEHR/trunk/r/PATCH_MANAGEMNT-AAQ/AAQDIRXM.m@ 701

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1AAQDIRXM ;FGO/JHS;Directory Listing via MailMan ; 09-03-98 [2/26/04 11:32am]
2 ;;1.0;AAQ LOCAL;;09-03-98;For Kernel V8.0 and OpenM-NT
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 !!,"This will List Files in a Selected Directory on an Alpha-NT",!,"system, and send the output to you in a MailMan message."
6 D UCI^%ZOSV S AAQUCI=Y,AAQX=$$NOW^XLFDT W !!,^DD("SITE")," ",AAQUCI," ",$$FMTE^XLFDT(AAQX),!!,"The DOWNLOAD Directory for this system will be the default."
7 W !!,"The default for this Site and UCI is: "
8TST I AAQUCI="TST,ROU" S AAQDISK="Y:\",AAQDIR="DOWNLOAD\" W AAQDISK_AAQDIR G ASKOK
9VAH I AAQUCI="VAH,ROU" S AAQDISK="T:\",AAQDIR="TEMP\" W AAQDISK_AAQDIR
10ASKOK S %=1 W !,"Is this the correct directory" D YN^DICN G:%=1 INFO I %=0 W !!,"This routine will not work correctly if directory names are wrong." G ASKOK
11 S AAQDIR="" W !!,"A null response or '^' for Drive will exit the routine.",!,"A null response is allowed for Directory, '^' will exit."
12ASKDISK R !!,"Enter Drive Letter with colon and backslash: ",AAQDISK:60 G:(AAQDISK="^")!(AAQDISK="") KILL I AAQDISK'?1A1":\" W $C(7),!!,"Answer must be one letter, a colon, and backslash." G ASKDISK
13ASKDIR R !!,"Enter Directory with trailing backslash: ",AAQDIR:60 G:AAQDIR="^" EXIT G:AAQDIR="" INFO I AAQDIR'?.E1"\" W $C(7),!!,"Answer must include a trailing backslash unless null." G ASKDIR
14INFO W !!,"Directory Listing will be sent by MailMan to your IN Basket."
15 W !,"An invalid path, or any failure to open the directory log file,",!,"will result in an alert and a message missing the file list.",!
16 S (AAQFAIL,ALERT,CNT)=0,DIRLOG=AAQDISK_AAQDIR_"AAQDIR.LOG"
17 O DIRLOG:"WA":5 I $T=0 S ALERT=1 D MSG(DIRLOG,ALERT) G EXIT
18 U DIRLOG S AAQX=$$NOW^XLFDT W !,^DD("SITE")," ",AAQUCI," ",$$FMTE^XLFDT(AAQX),!
19 S AAQFN="*.*",AAQFILE=$ZSEARCH(AAQDISK_AAQDIR_AAQFN)
20 F Q:AAQFILE="" D S AAQFILE=$ZSEARCH("")
21 . I AAQFILE=(AAQDISK_AAQDIR_".") Q
22 . I AAQFILE=(AAQDISK_AAQDIR_"..") Q
23 . U DIRLOG W !," ",AAQFILE S CNT=CNT+1
24 . Q
25 U DIRLOG W !!,"The number of files is: "_CNT
26 C DIRLOG
27 D MSG(DIRLOG,ALERT)
28 I '$D(XMZ) D FAILED
29 G EXIT
30MSG(DIRLOG,ALERT) ;
31 ; 0 (no alert) or 1 (send alert)
32 S $ZT=$G(^%ZOSF("ERRTN"))
33 S U="^",AAQTEXT="",AAQLOGOK=1
34 I $G(DIRLOG)'="" D
35 .O DIRLOG:"R":5
36 .I '$T S AAQLOGOK=0
37 .I 'AAQLOGOK D
38 ..S AAQTEXT(1,0)="Log file: "_DIRLOG_" could not be opened!"
39 I $G(DIRLOG)="" D
40 .S AAQLOGOK=0
41 .S AAQTEXT(1,0)="No AAQDIR.LOG file was created! Please check"
42 .S AAQTEXT(2,0)=" the "_AAQDISK_AAQDIR_" directory to confirm."
43 I AAQLOGOK D TEXT
44 S AAQNOW=$$NOW^XLFDT,AAQDATE=$$FMTE^XLFDT(AAQNOW)
45 S XMDUZ=DUZ,XMSUB=AAQUCI_" Directory Listing for "_AAQDISK_AAQDIR_" "_AAQDATE
46 S XMY(DUZ)="",XMTEXT="AAQTEXT("
47 D ^XMD
48 ; Send An Alert
49 I $G(ALERT)=1 D
50 .S XQA(DUZ)=""
51 .S XQAMSG="AAQDIR.LOG Problem - See Directory Listing Message #"_XMZ
52 .D SETUP^XQALERT
53 .K XQA,XQAMSG
54 Q
55TEXT S $ZT="ENDLOG"
56 S AAQLINE=0
57 F U DIRLOG R X:DTIME S AAQLINE=AAQLINE+1,AAQTEXT(AAQLINE,0)=X
58ENDLOG C DIRLOG
59 S $ZT=$G(^%ZOSF("ERRTN"))
60 Q
61FAILED S ALERT=1
62 O DIRLOG:"WA":5 I $T=0 D MSG(DIRLOG,ALERT) Q
63 U DIRLOG W !!,"Directory Message Failed."
64 D MSG(DIRLOG,ALERT) I $T=0 S AAQFAIL=1
65 I AAQFAIL=1 U DIRLOG W !!,"AAQDIRXM unable to create Alert."
66 C DIRLOG S AAQFAIL=1 ;AAQDIR.LOG is not deleted when Failed
67 Q
68EXIT G:AAQFAIL=1 KILL S AAQFN="AAQDIR.LOG",AAQFILE=$ZSEARCH(AAQDISK_AAQDIR_AAQFN) G:AAQFILE="" KILL S X=$ZF(-1,"DEL "_AAQFILE)
69KILL K %,%Y,AAQDATE,AAQDIR,AAQDISK,AAQFAIL,AAQFILE,AAQFN,AAQLINE,AAQLOGOK,AAQNOW,AAQTEXT,AAQUCI,AAQX,ALERT,CNT,DIRLOG,X,XMDUZ,XMSUB,XMTEXT,XMY,XMZ,Y
70 Q
Note: See TracBrowser for help on using the repository browser.