[comp.os.vms] file sharing

poneill@AMSAA-SEER.ARPA ("Patrick J. O'Neill") (12/08/87)

	We are trying to develop a file sharing mechanism between two
simulations running on different nodes of the same DECNET. Does anyone
have a sample high level language program (preferably PASCAL , but any
other language would be welcome) that calls RMS routines to accomplish the
user interlock file sharing (setting a bit in FAB$B_SHR) ? In older versions
of VMS (pre-4.n), there used to be a manual called something like the
"Language Support Reference Manual", but it seems to have been removed from
the standard documentation kit. 

				Thanks in advance,
			
						Patrick J. O'Neill

XRBEO@VPFVM.BITNET (Bruce O'Neel) (12/10/87)

This is how I do file sharing in fortran (sorry, not in pascal)


 Program 1.  Runs on node2, opens a relative file on node 1 and processes
it.
       include '($foriosdef)'
       open (10,file='node1::file.shared',status='old',shared,
     1       access='direct',organization='relative',recordtype='fixed,
     2       recordsize=80)

 Later in the program

      read (10,rec=145,iostat=ios) record_1
      if (ios .eq. for$ios_sperecloc) then
* the record is locked, do what ever you want until it is unlocked
      else
            call error (ios)
      endif
      unlock (10)  ! permits others to use this record now


 The program which runs on node 1 is the same, it just specifies a file name
of file.shared rather than node1::file.shared.  Almost all of this is from
  Programming in VAX FORTRAN.  There should be a compariable pascal manual.


Hope this helps..... bruce <xrbeo@vpfvm>  All standard disclaimers

mst@csun.UUCP (Mike Temkin) (08/04/88)

A while ago I posted a question asking about opening a file so that
more than one person could read it at a time.  What I received was
a steady flow of answers from many helpful people.  For those of you
that don't know the answer to my question, I have learned the following:

	1.  RMS handles opening files for 'shared' mode.
	2.  Languages have in corporated this into their 
		'open' calls (well, most of them anyway,
		no blanket statements from me. :-)).

I'd like to thank all of you that responded.  I only have a small 
set of VMS manuals, and after looking over some of them I came to the
conclusion (incorrectly, I may add) that it was a 'SET FILE' qualifer.
And not finding anything in the DCL manual for SET FILE asked my question
here.  I received many helpful messages and one blatently nasty 'RTFM'
message.  With less than 1 year experience with this system I hope to
eventually learn enough to help someone else in return.


Thanks.
-- 
Mike Temkin
...!{sdcrdcf,hplabs,psivax,ttidca}!csun!mx!mst
Cal. State U. Northridge, School of Engineering and Computer Science