[Info-vax] Multiple File Readers/Writers

Matt matt-nospam at 9track.net
Thu Nov 24 20:29:48 EST 2011


I'm trying to port SQLite to OpenVMS/Integrity. It's mostly working so
far with only a few minor changes required thanks to the 'unix
compatibility' layer in the C runtime library. However what doesn't work
is the ability for multiple processes to access the same database file
at the same time.

I've written two small test programs using the same functions as the
SQLite module to demonstrate the problem. One is called 'writer' which
opens a file test.dat and writes a counter every second into the first
few bytes. The second program 'reader' opens the same file and displays
the counter once per second. I've tried them on Windows and Linux and
they work as expected, however on VMS the counter never updates and the
reader seems to be dealing with a cached version of the file on disk.
The only way to get the counter to update is to close and open the file
on every read operation.

I've read the relevant sections of 'Guide to OpenVMS File Applications',
'OpenVMS Record Management Services Reference Manual' and the 'C
Run-Time Library Reference Manual' and tried many combinations of
options but always get the same result.

What combination of parameters do I need to pass to the 'open' call to
get the file sharing to work properly so that the reader does not get
stale data?

The test programs are located here:

http://www.9track.net/vms/reader.c
http://www.9track.net/vms/writer.c

Thanks,

Matt



More information about the Info-vax mailing list