source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZISFDTM.m@ 738

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

initial load of WorldVistAEHR

File size: 2.8 KB
RevLine 
[613]1%ZISF ;SFISC/AC -- HOST FILES (DataTree) ;6/21/93 15:36
2 ;;8.0;KERNEL;;JUL 10, 1995
3 ;
4HFS Q:$D(IOP)&$D(%IS("HFSIO"))&$D(%IS("IOPAR"))
5 I $D(%ZIS("HFSNAME")) D Q:'$D(%ZIS("HFSMODE"))
6 .I $D(%ZIS("HFSMODE")) D Q
7 ..S %ZISOPAR=$$MODE^%ZISF(%ZIS("HFSNAME"),%ZIS("HFSMODE"))
8 ..W:'$D(IOP) " HOST FILE TO USE: "_%ZIS("HFSNAME")
9 ..S %X=%ZIS("HFSNAME") Q
10 .S %X=%ZIS("HFSNAME")
11 .W:'$D(IOP) " HOST FILE TO USE: "_%ZIS("HFSNAME"),! Q
12 E D ASKHFS
13H S:$D(%ZIS("HFSMODE")) %ZISOPAR=$$MODE^%ZISF(%X,%ZIS("HFSMODE"))
14H1 I $D(IO("Q"))!(%IS["Z") S IO("HFSIO")=""
15 I %X="",%ZISOPAR="" W:'$D(IOP) !,"HOST FILE SPECIFICATION NOT DEFINED" S POP=1 Q
16 I $E(%ZISOPAR)'="(",%ZISOPAR'[""":""" S %ZISOPAR="(""W"""_":"""_%ZISOPAR_""")"
17 I $D(IO("HFSIO")) S IO("HFSIO")=IO
18 D ASKPAR^%ZIS6,SETPAR^%ZIS3 Q:$D(IOP)
19 I %ZTYPE="HFS",'$D(%ZIS("HFSMODE")),'$P(^%ZIS(1,%E,0),"^",4),$P($G(^%ZIS(1,%E,1)),"^",6) D HFSIOO Q:POP
20 S %ZISMODE=$P($P(%ZISOPAR,""":""",1),"(""",2) Q:%ZISMODE="A"
21 S %ZISFN=$P($P(%ZISOPAR,""":""",2),""")",1)
22 D FREEDEV^%ZOSV1 I IO="" W:'$D(IOP) *7," No free I/O channels." S POP=1 Q
23 D EXIST Q:%ZISFLG=1
24 I '%ZISFLG W !,"File ",%ZISFN," does not exist!" S POP=1 Q
25OVERWR W !!,"File ",%ZISFN," exists. Overwrite" S U="^",%=2 D YN^%ZIS1
26 I %=0 W !,"Answer YES or NO" G OVERWR
27 S:%'=1 POP=1 Q
28HFSIOO ;
29 W:$X>40 ! W ?45,"INPUT/OUTPUT OPERATION: " D SBR^%ZIS1
30 S %X=$ZCONVERT(%X,"U")
31 I $D(DTOUT)!$D(DFOUT)!$D(DUOUT) S POP=1 Q
32 I %X="?"!($F("?^R^W^A",%X)'>1) D HOPT
33 I %X="??" S %ZISHFR="XUHFSPARAM-DTM" D HELPFR
34 G HFSIOO:%X["?"!($F("?^R^W^A",%X)'>1)
35 I %X]"" S %ZISOPAR="("""_%X_""":"_$P(%ZISOPAR,":",2,9)
36 Q
37HOPT W !,"Enter one of the following host file input/ouput operation:"
38 W !,?16,"R = READ",!,?16,"W = WRITE",!,?16,"A = APPEND" Q
39 ;
40HELPFR S %ZISI=$O(^DIC(9.2,"B",%ZISHFR,0)) Q:'%ZISI Q:'$D(^DIC(9.2,+%ZISI,0)) Q:$P(^(0),"^",1)'=%ZISHFR
41 Q:$D(^DIC(9.2,+%ZISI,1))'>9 F %X=0:0 S %X=$O(^DIC(9.2,+%ZISI,1,%X)) Q:%X'>0 I $D(^(%X,0)) W !,^(0)
42 W ! S %X="??" Q
43 ;
44HLP1 W !,"Enter a valid file name for the host operating system" Q
45EXIST ;
46 I $P($ZVER,"/",2)<4 S %ZISFLG=1 Q
47 S %ZISFLG=($$files^%dos(%ZISFN)]"")
48 I %ZISFLG&(%ZISMODE="W") S %ZISFLG=-1 Q
49 I %ZISFLG=0&(%ZISMODE="R") Q
50 S %ZISFLG=1
51 Q
52 ;
53ASKHFS ;---Ask host file name---
54 S %X='$P($G(^%ZIS(1,%E,1)),"^",5)
55 Q:$D(IOP)!%X!$D(%ZIS("HFSNAME"))
56 ;W !,"HOST FILE NAME: " W:%ZISOPAR]"" %ZISOPAR_"// " D SBR^%ZIS1
57ASKAGN W !,"HOST FILE NAME: " D SBR^%ZIS1
58 I %X?1."?".E S %ZISHFR="XUHFS-DTM" D HLP1 D:%X["??" HELPFR G ASKAGN
59 I $D(DTOUT)!$D(DUOUT) S POP=1 Q
60 I $E(%X)="""",%X'[""":""" S %X=$E(%X,2,$L(%X)-1)
61 D SETOPAR
62 Q
63SETOPAR I %ZISOPAR?1"("1"""".A1""""1":"1"""".ANP1""""1")" S $P(%ZISOPAR,"""",4)=%X Q
64 S %ZISOPAR=%X
65 Q
66MODE(X1,X2) ;Return value in Y
67 N Y
68 S Y="("_""""_$S(X2="RW":"M",X2="R":"R",X2="W":"W",X2="A":"A",1:"W")_""":"_""""_X1_""")"
69 Q Y
Note: See TracBrowser for help on using the repository browser.