[fa.info-vax] Sharing sequential files

info-vax@ucbvax.ARPA (07/23/85)

From: lionel%orphan.DEC@decwrl.ARPA  (Steve Lionel)

RMS allows you to write-share a sequential file, where there is at least
one writer, but it requires you to also declare that you are responsible for
any interlocking problems by setting the "User-Provided-Interlock" (FAB$V_UPI)
bit.  VAX FORTRAN and VAX Pascal do this automatically if you have specified
shared access and have EXPLICITLY specified ORGANIZATION='SEQUENTIAL' (or
the Pascal equivalent). If you don't do this, RMS will complain about
"invalid file sharing options".  The reason you must specify the
organization is so that the RTL knows that YOU know what the organization
is.

If you ask for this, what you don't get is record locking, of course,
but you also don't get RMS trying to keep the end-of-file point consistent
for all accessors.  When one stream opens the file, it remembers what the
EOF point is when it opens it, and can't read past that.  If you have
write access, records you write move the EOF point, and this modified EOF
point gets written back to the file when it is closed.  If you have
multiple writers, this can cause extreme confusion, as each writer thinks
it knows what the correct EOF point is.

You can ask RMS to allow yourself to write, but others only to read.  This
is done by setting FAB$V_SHRGET only (along with FAB$V_UPI).  FORTRAN
doesn't have the syntax to do this directly, requiring a USEROPEN, but
in Pascal you can say SHARING:=READONLY.

More information about sharing files in FORTRAN and Pascal can be found in
section 5.1.3 (Sharing Data in Files) in the VAX FORTRAN User's Guide,
and in section 4.8 (File Sharing) of the VAX Pascal User's Guide.

Those of you who have back issues of the VAX Systems Dispatch may also want
to look at article 9.28.1 in the July 1981 issue for information on
multiple writers to sequential files.