Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!lll-lcc!ames!ucbcad!ucbvax!eg.ti.COM!BOLTHOUSE%MCOPN1
From: BOLTHOUSE%MCOPN1@eg.ti.COM
Newsgroups: comp.os.vms
Subject: RE: RMS question/shared file access...
Message-ID: <8707170911.AA18393@ucbvax.Berkeley.EDU>
Date: Tue, 14-Jul-87 10:14:00 EDT
Article-I.D.: ucbvax.8707170911.AA18393
Posted: Tue Jul 14 10:14:00 1987
Date-Received: Sat, 18-Jul-87 13:06:43 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 44

John Weald says (sort of):

I want to have a shared read request succeed, and have a subsequent shared
write request fail.  I'm using RMS from C.

>Shared Output:
>	fab$b_fac = FAB$M_PUT	 - I want to put records
>	fab$b_shr = FAB$M_SHRGET - I will allow shared gets
>
>Shared Input
>	fab$b_fac = FAB$M_GET	 - I want to get records
>	fab$b_shr = FAB$M_SHRPUT - Puts are allowed
>	            FAB$M_SHRGET - Others can also read records
>		    FAB$M_SHRDEL - Others can delete records
>		    FAB$M_SHRUPDATE - Others can update records
>
>Thus the following happens:
>	1) User 1 opens file for shared input.
>	2) User 2 opens the file for shared output, the open succeeds. 
>	   The file gets truncated. User 1 still sees the "old" file.
>
>We want the open in 2) to fail, but can see no way to do this with the RMS
>file sharing flags. The question is then how can we tell if a file is open
>in RMS (or in VMS in general)? 

I believe the problem is due to the fact that RMS is opening a new file.
If you could coerce RMS into attempting to open the same file, it should
behave as you want.  So, use the $PARSE service to determine the version
number of the most recent file and open *it* for shared output.  This should
fail, since you're attempting to perform incompatible operations on the
same file.  If you don't specify the exact version number, RMS uses x.y;0.
The default action of this file specification when opening for write access
is "Make me a new file".  Ergo, the problem you have noticed when trying
to emulate UNIX-style I/O.  Note I haven't tested this theory, but that's my 
experience with RMS.

Good luck!

David L. Bolthouse
Texas Instruments Defense Electronics Information Systems VAX System Support
McKinney, TX

AT&T:     214.952.2059
Internet: bolthouse%mcopn1@eg.ti.com