1 | %ZISF ;SFISC/AC - HOST FILES FOR GT.M on Unix/VMS ;10 Feb 2003 6:35 pm
|
---|
2 | ;;8.0;KERNEL;**275**;Jul 10, 1995
|
---|
3 | HFS ;Host File Server
|
---|
4 | Q:$D(IOP)&$D(%IS("HFSIO"))&$D(%IS("IOPAR"))
|
---|
5 | I $D(%ZIS("HFSNAME")) S IO=%ZIS("HFSNAME"),%X=IO ;
|
---|
6 | E D ASKHFS
|
---|
7 | H S:$D(%ZIS("HFSMODE")) %ZISOPAR=$$MODE(%ZIS("HFSMODE"))
|
---|
8 | H1 I $D(IO("Q"))!(%IS["Z") S IO("HFSIO")=""
|
---|
9 | S IO=$S(%X]"":%X,1:IO),IO=$$CHKNM(IO) ;See that we have a directory
|
---|
10 | S:$D(IO("HFSIO")) IO("HFSIO")=IO
|
---|
11 | W:'$D(IOP)&$D(%ZIS("HFSNAME")) " HOST FILE TO USE: "_%ZIS("HFSNAME"),!
|
---|
12 | D ASKPAR^%ZIS6,SETPAR^%ZIS3
|
---|
13 | HFSIOO I '$D(IOP),%ZTYPE="HFS",'$D(%ZIS("HFSMODE")),'$P(^%ZIS(1,%E,0),"^",4),%ZISOPAR="",$D(^%ZIS(1,%E,1)),$P(^(1),"^",6) W ?45,"INPUT/OUTPUT OPERATION: R//"
|
---|
14 | Q:'$T D SBR^%ZIS1 I $D(DTOUT)!$D(DFOUT)!$D(DUOUT) S POP=1 Q
|
---|
15 | D HOPT:%X="?"!'$$CHECK(%X),HOPT1:%X="??" G HFSIOO:%X="?"!'$$CHECK(%X)
|
---|
16 | S:%X]"" %ZISOPAR="("""_%X_""")" Q
|
---|
17 | ;
|
---|
18 | CHECK(X) ;Check that we have valid option
|
---|
19 | N Y,%
|
---|
20 | Q:(X["R")&(X["W") 0 ;Can't have both
|
---|
21 | S Y=1 F %=1:1:$L(X) I "AFNRSVW"'[$E(X) S Y=0
|
---|
22 | Q Y
|
---|
23 | ;
|
---|
24 | ASKHFS ;---Ask host file name here---
|
---|
25 | I $D(%IS("B","HFS"))#2,%IS("B","HFS")]"" D
|
---|
26 | .S IO=%IS("B","HFS") ;Set default host file name
|
---|
27 | S %X='$P($G(^%ZIS(1,%E,1)),"^",5)
|
---|
28 | S:'%X %X=""
|
---|
29 | I $D(IOP)!%X!$D(%ZIS("HFSNAME")) S %X="" Q
|
---|
30 | ASKAGN W !,"HOST FILE NAME: "_IO_"//" D SBR^%ZIS1
|
---|
31 | I %X?1."?".E W !,"ENTER HOST FILE NAME" G ASKAGN
|
---|
32 | S:$D(DTOUT)!$D(DUOUT) POP=1
|
---|
33 | Q
|
---|
34 | CHKNM(H) ;Check the HFS name
|
---|
35 | N N S N=H
|
---|
36 | I $ZV["VMS" D
|
---|
37 | . I (H'[":")&(H'["[") S N=$$DEFDIR^%ZISH("")_H
|
---|
38 | E D
|
---|
39 | . I (H'["/") S N=$$DEFDIR^%ZISH("")_H
|
---|
40 | Q N
|
---|
41 | ;
|
---|
42 | MODE(X) ;Return %ZISOPAR in Y.
|
---|
43 | N Y,Q S Q=$C(34)
|
---|
44 | S Y=$S(X["R"&(X["W"):"(VARIABLE)",X="N":"(NEWVERSION:NOREADONLY:VARIABLE)",X="W":"(NEWVERSION:NOREADONLY:VARIABLE)",X="A":"(APPEND:NOREADONLY:VARIABLE)",1:"(READONLY:VARIABLE)")
|
---|
45 | Q Y
|
---|
46 | ;
|
---|
47 | HOPT W !,"You may enter a string of codes that represents",!,"the following host file input/ouput operation:"
|
---|
48 | W !?16,"R = READ ACCESS",!?16,"W = WRITE ACCESS",!?16,"N = NEWVERSION",!?16,"S = FIXED FORMAT",!?16,"V = VARIABLE FORMAT",!?16,"A = APPEND"
|
---|
49 | W !,"Example valid groupings 'RV', 'NW', 'AWV'"
|
---|
50 | Q
|
---|
51 | HOPT1 S %ZISI=$O(^DIC(9.2,"B","XUHFSPARAM-GUX",0)) Q:'%ZISI Q:'$D(^DIC(9.2,+%ZISI,0)) Q:$P(^(0),"^",1)'="XUHFSPARAM-GUX"
|
---|
52 | 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)
|
---|
53 | W ! S %X="??" Q
|
---|