[comp.os.vms] Multiple-access files in VMS

dragon@NSCVAX.PRINCETON.EDU (Richard B. Gilbert) (08/02/88)

   Mike Temkin writes:
>Does anyone out there know how to make a file multi-accessible (readwise)
>in VMS?  There must be a way since I would think that the help file is
>that way.  Any help is appreciated.

   Sharability is not an attribute of a VMS file.  File sharing is
controlled by the bits in FAB$B_SHR in the File Access Block (FAB) which
are set when a program opens the file.  As soon as a program opens a file
for exclusive access, it is no longer shareable. 

   Any program that opens a file to write to it will almost certainly open
it for exclusive access.  Programs written in high level languages 
sometimes default to exclusive access.  From VAX Fortran, for example, the
OPEN statement must include the keyword SHARED, else the file is opened for
exclusive access, (FAB$B_SHR=FAB$V_NIL).

    See "VAX Record Management Services Reference Manual", Order No. 
AA-Z503B-TE for more than you wanted to know about file sharing. :-)

ZSYJKAA@WYOCDC1.BITNET (Jim Kirkpatrick 307 766-5303) (08/04/88)

(I sent this reply to the original poster but Rutgers rejected it with
host unknown for unisys.com)

  >From:     cs.utexas.edu!sm.unisys.com!csun!mst@RUTGERS.EDU
     [good grief!]
  >Does anyone out there know how to make a file multi-accessible (readwise)
  >in VMS?  There must be a way since I would think that the help file is
  >that way.  Any help is appreciated.
  >
  >Mike Temkin
  >...!{sdcrdcf,hplabs,psivax,ttidca}!csun!mx!mst
     [good grief again!]
  >Cal. State U. Northridge, School of Engineering and Computer Science

You need to be more specific about what made you think it didn't work
in the first place.  What language were you using?  What was the message
you got saying you couldn't?

I will assume, for at least illustration purposes, Fortran.  The answer is
RTFM.  Look at the OPEN statement, READONLY keyword.  That'll do it, I
suspect, since default open is in in/out mode which means only one process
can have the file open.

Jim Kirkpatrick       ZSYJKAA@WYOCDC1   (on BITNET)

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (08/09/88)

 >   You can, however, set the flag FAB$V_RRL (Read Regardless of Lock) in
 > FAB$L_FOP (at least in MACRO, I don't know if any of the high-level
 > languages provide a way to do this).

I think you've confused overriding record locks with overriding exclusive file
access.   There  is  no  FAB$VRRL  (at  least  not in the VMS 4.7 macro, C, or
FORTRAN libraries); however, there IS a RAB$VRRL which permits you to  read  a
record  even if it is currently locked.  To open a file that's been opened for
exclusive access would appear to take calls to the ACP/QIO interface.