"Aleksandar Donev" <[log in to unmask]> wrote:
...
> I have only used NAMELISTs with Lahey so far, and the process is as
> follows: I put all my namelist input in one file, and then REWIND before
> trying to read a namelist, and simply issue the READ statement. This way
> I avoid issues of ordering of the namelists in the file and the order of
> reading, which changes from run to run.
>
> It was my understanding this is what F95 says this is all OK. But NAG is
> now giving me a runtime error:
>
> Expected NAMELIST group /LSDPARTICLESHAPES_DHS/ but found /LSDPACKINGSIZE/
>
> which means it does not skip over the other namelists while looking
> for LSDPARTICLESHAPES_DHS as I expected.
In the old days, the I/O process for namelist (which wasn't standardized
until F90) did all kinds of things like you describe above. Some versions
even searched the input file circularly until they either found the proper
namelist or got back to the starting point (so, you wouldn't even have to
rewind like you've been doing). The problem is that the position of the
file after a namelist read became increasingly difficult to predict. Especially
if there were multible namelist input blocks for the same namelist in the file,
and if non-namelist data was also present.
The Fortran standard does not specify any file searching operations be
done for namelist I/O. Implementations may do so as an extension. But
you should really order you files in the same order as the I/O statements
you use. You have to do that for all other types of I/O.
--
J. Giles
|