- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a dbaseIII file (belongs to an ESRI shape file) which, under OpenVMS/alpha, I open with the following:
open(unit=1,file=fname,status='old',form='unformatted', &
recl=128,recordtype='fixed',iostat=ios,err=1000)
OpenVMS sees the file as a number of 512 byte blocks, even though the data does not exactly fill all the blocks. In a read loop a test program will read 12 * 512 bytes before an eof-of-file condition is reached. This is the read statement I am using:
read(1,iostat=ios)(block(i),i=1,512)
However, in Windows using CVF, the same program with the same file and the same open and read statements reaches end-of-file after only 11 reads. In other words, the last couple of hundred bytes in the partially filled last block never get read. I presume this is because Windows does not see the file as a number of whole 512 byte blocks.
I have tried various different switches in the open statement, but none of them work. Perhaps the whole approach is wrong?
I have several large old programs to convert to the Windows environment and all will have this problem, so I must solve it. Please, does anyone know how to do this?
With many thanks in advance,
Mike.
open(unit=1,file=fname,status='old',form='unformatted', &
recl=128,recordtype='fixed',iostat=ios,err=1000)
OpenVMS sees the file as a number of 512 byte blocks, even though the data does not exactly fill all the blocks. In a read loop a test program will read 12 * 512 bytes before an eof-of-file condition is reached. This is the read statement I am using:
read(1,iostat=ios)(block(i),i=1,512)
However, in Windows using CVF, the same program with the same file and the same open and read statements reaches end-of-file after only 11 reads. In other words, the last couple of hundred bytes in the partially filled last block never get read. I presume this is because Windows does not see the file as a number of whole 512 byte blocks.
I have tried various different switches in the open statement, but none of them work. Perhaps the whole approach is wrong?
I have several large old programs to convert to the Windows environment and all will have this problem, so I must solve it. Please, does anyone know how to do this?
With many thanks in advance,
Mike.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What happens if you change the OPEN to use form='binary'?
The behavior of an unformatted read where there is not enough data to satisfy the read is undefined. There are various ways of solving this, but try the above first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steve,
Changing the form to 'binary' gives on IOSTAT error of 67 - 'an unformatted read statement attempted to read more data than existed in the record being read'. If I also change the recordtype from 'fixed' to 'stream', the program runs OK but stops short at 11 reads, as before.
Do you have any other suggestions?
Many thanks for your help.
Mike
Changing the form to 'binary' gives on IOSTAT error of 67 - 'an unformatted read statement attempted to read more data than existed in the record being read'. If I also change the recordtype from 'fixed' to 'stream', the program runs OK but stops short at 11 reads, as before.
Do you have any other suggestions?
Many thanks for your help.
Mike
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page