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

mst@csun.UUCP (Mike Temkin) (07/26/88)

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
Cal. State U. Northridge, School of Engineering and Computer Science

jkingdon@chinet.chi.il.us (James Kingdon) (07/28/88)

In article <1391@csun.UUCP> mst@csun.UUCP (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.

I assume what you are saying is that you want 2 programs to both be able
to read a single file simultaneously.

RMS (Record Management Services) has 2 fields that you set when you open
a file:  FAC (File Access), which is what you want to be able to do to
the file, and SHR (Sharing), which is what you want to let other processes
do.  So in this case you set FAC to GET and SHR to include SHRGET (you
may also wish to include SHRPUT, SHRUPD, etc.)

If you are trying to use the language-specific file I/O routines in C,
Pascal, FORTRAN, etc. I don't know whether they let you specify both
of these fields.  It is possible you might have to go directly to RMS.

And if one of the programs is one you can't change, and it opens the file
without allowing sharing, as far as I know you are Simply Out of Luck.

terrell@musky2.MUSKINGUM.EDU (Roger Terrell) (07/28/88)

In article <1391@csun.UUCP> mst@csun.UUCP (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.

>Mike Temkin


To make a file readable (or writeable) by multiple users, just use an
option to the OPEN procedure of whatever language you are using.

An example from VAX Pascal:

  OPEN (InputFile, 'INPUT-FILE.TXT', 
        HISTORY := READONLY,
        SHARING := READONLY);

The statement would be similar in other languages.

--Roger

-- 

Roger Terrell
...musky2!terrell (UUCP) 
terrell@muskingum.edu (CSNet)

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

 > 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.

I take it you mean you want several processes to be  able  to  read  the  file
simultaneously.   This  is not an attribute of the file; it depends on how you
open the file.  The following three examples show you how to do it in three of
the most commonly used high-level languages.

In FORTRAN:
		OPEN(UNIT=1,FILE='TEST.DAT',SHARED,READONLY,STATUS='OLD')
In C:
	#include file
		int fd;
		fd = open("TEST.DAT", O_RDONLY, 0777, "shr=get");
In DCL:
	$ open/read/share=read file test.dat