Richard,
Thanks for the reply. Thanks to you and Dick Russell's suggestions, I've
got it running. Also, in reply:
1. I hadn't realized that more than one F compiler exist, I'm using the
FORTRAN Company's version.
2. Yep, there were several input file problems. One was reading character
data into integer fields (leading to...
...3. iostat being called for but not used. This was a remnant of an
earlier version of the skit, and I left it in thinking "no harm done" ...
lesson learned!
Thanks again!
Ernest Blair
Sr. Modeling & Simulation Eng. - Operations Research
Future Combat Systems, Lead Systems Integration Team, Manned Ground Vehicles
- SAIC, 4110 Campus Point Ct, M/S E3-X, San Diego, CA 92121
______________________________________
tel: 858-826-5138 fax: 858-826-5129
[log in to unmask]
-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of
Richard E Maine
Sent: Tuesday, September 28, 2004 12:46 PM
To: [log in to unmask]
Subject: Re: Windows file I/O in F : newbie querstion
On Sep 28, 2004, at 11:10 AM, Blair, Ernest R. wrote:
> Program executes normally, but I get
> the header on unit 4 but nothing else....
Several comments
1. You don't mention what compiler. Not sure whether or not it is
relevant to your problem, but it could be.
2. The contents of the input file (well, at least the first few lines)
could also be relevant.
but most important...
3. It is a very bad practice to put iostat=something in an I/O
statement unless you are going to make some use of the returned iostat
value. The iostat= tells the system to *NOT* abort if it encounters an
error, but instead to return the appropriate iostat value. If then
ignore the iostat value, you've told the system to quietly ignore
errors, and you are also ignoring them.
The only situation in which this is even half sensible is when you
expect errors and expect them to be harmless. Even then, it is usually
better to check that you are getting the errors that you expect instead
of some other ones.
If you aren't going to do something with the iostat-returned value
(print it out, test it, or something), then don't ask for it. The
system will then give you an error message when it hits an error.
Odds are that your open of the input file failed. Either that or the
read from the input file failed. Hard to say why. Take out the
iostat= and you'll probably get a more informative message.
> Also would like to end with an
> end-of-file on unit 5, but haven't figured that one out either.
use the iostat=. It will be negative if you have hit the end of file.
Postive means an error. Zero means all was ok. Or you could use end=,
but I personally prefer iostat=. related to teh first question,
though... if you use iostat= and get back a positive value, do
something instead of ignoring it (maybe just print it out).
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|