- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
character :: ch
integer :: commas
open (1,file='test.dat')
commas = 0
do
read (1,'(a)',advance='no',end=100,err=101) ch
if (ch == ',') commas = commas +1
end do
above will crash at record 1 crlf detect (err= is ignored) saying "end of record during read"
A couple CLF experts say above shud be able to scan the file for commas, but apparently not in cvf6.6b ??
integer :: commas
open (1,file='test.dat')
commas = 0
do
read (1,'(a)',advance='no',end=100,err=101) ch
if (ch == ',') commas = commas +1
end do
above will crash at record 1 crlf detect (err= is ignored) saying "end of record during read"
A couple CLF experts say above shud be able to scan the file for commas, but apparently not in cvf6.6b ??
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need an EOR= specification. The standard says that EOR and EOF are not "error conditions", and thus the ERR= branch is not taken. There's actually a few paragraphs about this in the release notes.
Steve
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's the text from the release notes:
In order to conform with clarified wording in the Fortran standard, the compiler has been changed so that when a READ statement encounters an end-of-file condition, and there is no END= specifier but there is an ERR= specifier, the ERR= branch is NOT taken. Similarly, if an end-of-record condition occurs but there is no EOR= specifier, an ERR= branch is not taken.
A further behavior change, to conform with the standard, has been implemented. If an EOF (or EOR) condition occurs and there is not an IOSTAT= or END= (or EOR= in the case of EOR) specifier, the program is terminated with an error message.
Steve
In order to conform with clarified wording in the Fortran standard, the compiler has been changed so that when a READ statement encounters an end-of-file condition, and there is no END= specifier but there is an ERR= specifier, the ERR= branch is NOT taken. Similarly, if an end-of-record condition occurs but there is no EOR= specifier, an ERR= branch is not taken.
A further behavior change, to conform with the standard, has been implemented. If an EOF (or EOR) condition occurs and there is not an IOSTAT= or END= (or EOR= in the case of EOR) specifier, the program is terminated with an error message.
Steve

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