dor@beach.cis.ufl.edu (Douglas R. Oosting) (01/11/90)
Im having a problem getting a filesharing module to work properly under
VMS 5.1, using their pascal compiler (3.9, I think)
Code chunk follows:
PROCEDURE WriteInfo (TheInfo : InfoRecPtr);
(* writes the info file to disk *)
BEGIN
REPEAT
REWRITE (PInfo);
WRITE (Pinfo, TheInfo^);
UNTIL (Status(PInfo)=0);
FIND (Pinfo, 1);
UNLOCK (Pinfo);
END;
The info file mentioned is a single-record file of type InfoRec (which
InfoRecPtr is a pointer to). This code loops forever without getting
anywhere. I presume the status call is in error, but I dont know of any
other way to check if the write was successful. The file was opened
with sharing := readwrite and organization := direct...
Trying to use LOCATE (Pinfo,1) and then writing it returns a nasty error
about using $PUT not at EOF or some such nonsense. Im confused, and the
system people on this machine aren't really pascal fluent. Can anybody
shed some light on this? Mail or post replies...
Thanks in advance,
Doug Oosting
--
Cogito ergo Spud | Douglas R. Oosting, University of Florida
(I think, therefore | dor@beach.cis.ufl.edu or Pendragon@oak.circa.ufl.edu
I yam...) |...{mailrus|gatech}!uflorida!beach.cis.ufl.edu!dor
In the Society : Cadrys ap Dulas o Caereira, Barony of An Crosaire, Trimarissynful@drycas.club.cc.cmu.edu (Marc Shannon) (01/15/90)
In article <21704@uflorida.cis.ufl.EDU>, dor@beach.cis.ufl.edu (Douglas R. Oosting) writes: > BEGIN > REPEAT > REWRITE (PInfo); > WRITE (Pinfo, TheInfo^); , Error := Continue > UNTIL (Status(PInfo)=0); try >= > FIND (Pinfo, 1); > UNLOCK (Pinfo); > END; Presuming that you've got the file opened with Sharing := ReadWrite (or ReadOnly but not None which is the default, I think), it should work, although I'm not quite sure why you'd get into an infinite loop. You might want to try it with the above mentioned changes. The first one is the "proper" to handle possibly-failing-I/O's and the second is useful because you might be getting -1 which means that the file pointer is at EOF. All non-positive values are generally OK. --Marc -- +-----------------------------------------------------------------------------+ | Marc Shannon Internet Address (Bitnet name) | | VAX Systems Programmer SYNFUL@DRYCAS.CLUB.CC.CMU.EDU (DRYCAS) | | Carnegie-Mellon University R602MS5U@VB.CC.CMU.EDU (CMCCVB) | | (412) 268-6290 "I mean, really, what could possibly go wrong?" | +-----------------------------------------------------------------------------+