HP OpenVMS Systems

ask the wizard
Content starts here

Opening a file for shared access?

» close window

The Question is:

I want to write a sequential ASCII output file and be able to display ($TYPE)
 the file while the image is running and the file is open.
By using fopen(fp, mode, "shr=get", "rat=cr", "rfm=var", "ctx=rec") with "w" or
 "a" mode, I can avoid "file locked by another user."
But even using fflush(fp) and/or fsync(fp), the output isn't being written to
 the disk until the file is closed.  A $DIR on the file always appears as
 0/<allocated> and $TYPE returns nothing.
I'm doing this with OpenVMS 7.2-1 and DECC 6.0, but I see the same behavior
 with later versions.
What am I missing?  How do I get the data written to the disk?  I looked at the
 freeware examples, but they seem to address only making sure the buffers are
 flushed before the file is closed.  I need to be able to examine the file at
 any time.

The Answer is :

  The OpenVMS FAQ covers what appears to be a variant of this particular
  topic, and specifically a discussion of reviewing the contents of an
  output file while the application is running.  This involves setting
  up the RMS file open operation for full file sharing, of course.

answer written or last revised on ( 29-NOV-2004 )

» close window