Re: Reading data



hhu <hxhu76@xxxxxxxxx> wrote:

I am new to Fortran.

Looks like Fortran 77. I'd generally recommend f90/f95 to new users. F90
is on;y a decade and a half old, as opposed to f77, which is 3 decades.
But that's a side comment.
[much elided]

list in: end of file
apparent state: unit 6 named EXAMPLE2.CSV
last format: list io
lately reading direct formatted external IO
Aborted

Hmm. The "direct" bit in "direct formatted external IO" seems strange. I
see no direct access around. I'll just ignore that as probably
misleading.

The message says that you tried to read data past the end of the file.
What you show as the file looks like it ought to be ok for the program
as shown. I can think of two areas of possibile problems.

1. The file has oddities that don't show up in copying it to the
posting. This might be incorrect line termination, particularly of the
last line, invisible characters (like control-Z), or other things. Hmm.
Speaking of invisible characters, the ".csv" in the name makes me a
little suspicious. I don't see any commas as the "csv" (comma-separated
variable) would lead me to expect, but does the file perhaps have tab
characters instead of blanks? That coudl cause problems.

2. More likely, I think... Unit 6 is an unfortunate choice, particularly
for an input file. I generally recommend using 2-digit unit numbers. The
unit numbers below 10 are often reserved for special purposes. In
particular, unit 6 is often connected to standard output. This could
cause problems. I'm not sure that is your probleem, but I'd recommend
using a different unit number to remove any possible question.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.