HP OpenVMS Systemsask the wizard |
The Question is: I am trying to write some file data to disk so that in the event of power failure the file will contain all data written to that file prior to the system crashing. The file is created in DECC and is open for periodic writing for 24 hours and then closed. I have tried the C call fflush() and I have tried NO BUFFER with setvbuf() but in each case the file is empty upon resumption of system power. This file receives over 100,000 writes per day and I would prefer not to open/close it at each write. TIA Gordon The Answer is : fflush will intruct the C RTL to move the data from the RTL buffers into the RMS buffers. To tell RMS to move its buffers out to disk, you should use the fsync functions (which will in the end call SYS$FLUSH). If the file indeed received 100,000s write per day, then the data must have been written through to disk (default buffer size is 8KB). The 'only' missing part will have been an updated end of file pointer. For desperate case, one can manually set this EOF pointer and magically bring the stored data to life! Check out DUMP/HEAD/BLOCK=COUNT=0 and $SET FILE/ATTR=(EBK=x,FFB=y) hth, Hein.
|