1 | %ZISF ;SFISC/AC - HOST FILES FOR Cache on NT & VMS ;06/14/2005 15:44
|
---|
2 | ;;8.0;KERNEL;**34,191,271,385**;Jul 10, 1995;Build 3
|
---|
3 | HFS ;Host File Server
|
---|
4 | ;Calling parameters in %ZIS override Device file.
|
---|
5 | Q:$D(IOP)&$D(%ZIS("HFSIO"))&$D(%ZIS("IOPAR"))
|
---|
6 | N %
|
---|
7 | ;Get file name
|
---|
8 | I $D(%ZIS("HFSNAME")) S IO=%ZIS("HFSNAME"),%X=IO ;
|
---|
9 | E D ASKHFS ;Return name in %X
|
---|
10 | ;Mode or actual parameters
|
---|
11 | H S:$D(%ZIS("HFSMODE")) %ZISOPAR=$$MODE(%ZIS("HFSMODE"))
|
---|
12 | H1 I $D(IO("Q"))!(%ZIS["Z") S IO("HFSIO")=""
|
---|
13 | S IO=$S($L(%X):%X,1:IO),IO=$$CHKNM(IO) ;See that we have a directory
|
---|
14 | S:$D(IO("HFSIO")) IO("HFSIO")=IO
|
---|
15 | I '$D(IOP)&$D(%ZIS("HFSNAME")) S %=" HOST FILE USED: "_%ZIS("HFSNAME") W:$X+$L(%)>75 ! W %,!
|
---|
16 | ;Check Ask Parameters
|
---|
17 | D ASKPAR^%ZIS6,SETPAR^%ZIS3
|
---|
18 | ;Check Ask IO Mode
|
---|
19 | HFSIOO I '$D(IOP),%ZTYPE="HFS",'$D(%ZIS("HFSMODE")),'$P(^%ZIS(1,%E,0),"^",4),%ZISOPAR="",$P($G(^%ZIS(1,%E,1)),"^",6) D
|
---|
20 | . W:$X>19 ! W ?20,"INPUT/OUTPUT OPERATION: R//"
|
---|
21 | Q:'$T D SBR^%ZIS1 I $D(DTOUT)!$D(DFOUT)!$D(DUOUT) S POP=1 Q
|
---|
22 | S:%X="" %X="R" S %X=$$UP^%ZIS1(%X)
|
---|
23 | D HOPT:%X="?"!'$$CHECK(%X),HOPT1:%X="??" G HFSIOO:%X="?"!'$$CHECK(%X)
|
---|
24 | S:%X]"" %ZISOPAR="("_$$MODE(%X)_")"
|
---|
25 | Q
|
---|
26 | ;
|
---|
27 | CHECK(X) ;Check that we have valid option
|
---|
28 | N Y,%
|
---|
29 | Q:(X["R")&(X["W") 0 ;Can't have both
|
---|
30 | S Y=1 I $L($TR(X,"ANRW")) S Y=0
|
---|
31 | Q Y
|
---|
32 | ;
|
---|
33 | ASKHFS ;---Ask host file name here---
|
---|
34 | I $D(%IS("B","HFS"))#2,%IS("B","HFS")]"" D
|
---|
35 | .S IO=%IS("B","HFS") ;Set default host file name
|
---|
36 | S %X='$P($G(^%ZIS(1,%E,1)),"^",5)
|
---|
37 | S:'%X %X=""
|
---|
38 | I $D(IOP)!%X!$D(%ZIS("HFSNAME")) S %X="" Q
|
---|
39 | ASKAGN W !,"HOST FILE NAME: "_IO_"//" D SBR^%ZIS1
|
---|
40 | I %X?1."?".E W !,"ENTER HOST FILE NAME" G ASKAGN
|
---|
41 | S:$D(DTOUT)!$D(DUOUT) POP=1
|
---|
42 | Q
|
---|
43 | CHKNM(H) ;Check the HFS name
|
---|
44 | N N,%OS S N=H,%OS=$ZV
|
---|
45 | I %OS["VMS",(H'[":")&(H'["[") S N=$$DEFDIR^%ZISH("")_H ;VMS - disk:[directory]file
|
---|
46 | I %OS["NT",(H'["\")&(H'[":") S N=$$DEFDIR^%ZISH("")_H ;NT - C:\DIR\FILE
|
---|
47 | I %OS["UNIX",(H'["/") S N=$$DEFDIR^%ZISH("")_H ;UNIX/Linux - ./file or /mnt/dir/file
|
---|
48 | Q N
|
---|
49 | ;
|
---|
50 | MODE(X) ;Return value for %ZISOPAR.
|
---|
51 | ;For VMS only, The H is for read SHARE. Going back to READ Stream mode.
|
---|
52 | N Y,Q S Q=$C(34)
|
---|
53 | I $ZV["VMS" S Y=$S(X="N":"NWS",X="W":"NWS",X="A":"AWS",1:"RHS")
|
---|
54 | E S Y=$S(X="N":"NWS",X="W":"NWS",X="A":"AWS",1:"RS")
|
---|
55 | Q $S($L(Y):Q_Y_Q,1:Y)
|
---|
56 | ;
|
---|
57 | HOPT W !,"You may enter a code that represents one of",!,"the following host file input/ouput operation:"
|
---|
58 | W !?16,"R = READ ACCESS",!?16,"W = WRITE ACCESS",!?16,"N = NEWVERSION",!?16,"A = APPEND"
|
---|
59 | Q
|
---|
60 | ;
|
---|
61 | HOPT1 S %ZISI=$O(^DIC(9.2,"B","XUHFSPARAM-MVX",0)) Q:'%ZISI Q:'$D(^DIC(9.2,+%ZISI,0)) Q:$P(^(0),"^",1)'="XUHFSPARAM-MVX"
|
---|
62 | 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)
|
---|
63 | W ! S %X="??"
|
---|
64 | Q
|
---|