(9886) Opening a file for shared access?

Archive of the OpenVMS Ask the Wizard (ATW) questions and answers database.
Locked

Topic author
User
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:16 am
Reputation: 0
Status: Offline

(9886) Opening a file for shared access?

Post by User » Sun Nov 28, 2004 8:26 am

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 no

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.
Last edited by marty.stu on Thu Aug 18, 2022 10:03 am, edited 1 time in total.


Wizard
Visitor
Posts: 0
Joined: Mon Jan 10, 2022 8:17 am
Reputation: 0
Status: Offline

Re: (9886) Opening a file for shared access?

Post by Wizard » Mon Nov 29, 2004 8:26 am

(2867) and FAQ cover 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.
Last edited by marty.stu on Thu Aug 18, 2022 10:09 am, edited 2 times in total.

Locked