- #1
jf22901
- 55
- 1
Hi all
I am using some code that was originally written in F77, but as it is many thousands of lines long, I haven't the time to go changing it. There is one section of code that refuses to work, but I'm assuming it must have at some point since the code has been used in the past!
Basically there is a section of code that reads some header details from a file, checks if there is enough space left in the array, and if there is continues reading the data from the file. For example, say there was an unformatted data file containing 20 floating point values. The code is something like this:
However, putting the two read statements like this (one after the other) doesn't seem to work. If I read the file in one continuous go then it is ok, but if I leave in the conditional check, and try to read the remaining data with second read statement, it just skips to the error print statement.
Can anyone offer any help? As I say, this code must have worked in the past (I think I might have used it before myself), so I don't know why it doesn't now. Could it be because I've changed from ifort v9 to ifort v12?
Thanks,
Jack
I am using some code that was originally written in F77, but as it is many thousands of lines long, I haven't the time to go changing it. There is one section of code that refuses to work, but I'm assuming it must have at some point since the code has been used in the past!
Basically there is a section of code that reads some header details from a file, checks if there is enough space left in the array, and if there is continues reading the data from the file. For example, say there was an unformatted data file containing 20 floating point values. The code is something like this:
Code:
open(10, file='datafile', form='unformatted', status='old')
! Read the first part of the file
read(10, end=2100) (header(i), i = 1, 10)
! Some conditional check to see if there is space for new data
if (x .lt. max) then
! If there is space, continue reading the remaining data
read(10, end=2100) (data(i), i = 1, 10)
endif
close(10)
2100 print*, 'FILE ERROR!'
However, putting the two read statements like this (one after the other) doesn't seem to work. If I read the file in one continuous go then it is ok, but if I leave in the conditional check, and try to read the remaining data with second read statement, it just skips to the error print statement.
Can anyone offer any help? As I say, this code must have worked in the past (I think I might have used it before myself), so I don't know why it doesn't now. Could it be because I've changed from ifort v9 to ifort v12?
Thanks,
Jack