Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Namelist read issue in Win7

SteveH
Beginner
1,635 Views
I am porting code between linux and win7. The namelist related code below works fine in linux, but gives me this error in windows:

forrtl: severe (24): end-of-file during read, unit 5, file z:\\wna\\postproc\\linux\\ena_gfdl\\ena_gfdl.info, line 21, position 1

I know it should be simple and easy to debug, but it has me stumped. Any insight would be appreciated.

Steve

character (len=80) grid,
* proj,
* date_convention,source,
* version, runtitle, author,
* time_convention, domain, surface,
* srfprefix, atmprefix, radprefix, fname_prefix

logical first,leap,stopflag

namelist /info/ version, runtitle, author,source,
* date_convention,time_convention,
* proj, domain, grid,
* yr1,yr2,leap,drive,surface,
* srfprefix, atmprefix, radprefix, fname_prefix
open(5,file='z:/wna/postproc/linux/ena_gfdl/ena_gfdl.info')
read (5,nml=info)


The namelist file ena_gfdl.info conatins:

&info
version="1.0"
runtitle="GFDL intialized 01/2038"
author="Hostetler"
source="GFDL time-varying boundary conditions"
date_Convention="Calender is noleap"
time_Convention="Serial months beginning 01/2038"
proj="Lambert conformal TruLat N30 and N60 degrees"
domain="ENA domain 251X256 grid points 23 vertical levels"
grid="center lat = N38.00 center long = -77.0 dx = 15000 m"
yr1=2050
yr2=2070
leap=.false.
drive = "/head1/Regional/RegCM/ena_gfdl2x/output/"
surface = "./ena15.dat"
srfprefix = "SRFGF."
atmprefix = "ATMGF."
radprefix = "RADGF."
fname_prefix = "ena_gfdl"
/

0 Kudos
11 Replies
mecej4
Honored Contributor III
1,635 Views
Add "implicit none" to your program, and you will see what the error is (assuming that you have shown all the relevant declarations that you have). Because of the bug, the program that you gave above crashed on Linux, as well.
0 Kudos
SteveH
Beginner
1,635 Views
I use implicit none in all of my codes, sorry I forgot to include that.
0 Kudos
mecej4
Honored Contributor III
1,635 Views
In that case, the compiler would have guided you into adding a declaration for drive as a character*80 variable and, perhaps, declaring yr1 and yr2 as integer. With that change made, the code runs fine in Linux and on WIndows 7-x64, after renaming the input file suitably.
0 Kudos
SteveH
Beginner
1,635 Views
Another oversight on my part, drive is declared many lines above the lines I included:

character yr_name(nyravg)*4, buffer*4, drive*80

As I mentioned in my first post, this code has been running fine on our linux machines. It also runs fine in win7 when I copy the namelist file into the code instead of trying to read it from the file. Thank you for help.
0 Kudos
DavidWhite
Valued Contributor II
1,635 Views
Have you tried with the input character strings delimited by single-quotes. I seem to recall having issues with single and double quotes before.

David
0 Kudos
SteveH
Beginner
1,635 Views
David-- yes, single, double, commas/no commas at the end of the lines.
0 Kudos
Steven_L_Intel1
Employee
1,635 Views
To make things simpler for us, would you please attach a short but complete source that shows the problem? Also attach a text file that contains the data you are reading. Pasting into the forum sometimes creates oddities.
0 Kudos
SteveH
Beginner
1,635 Views
Steve-- Here is a small source code file and the namelist text file it reads.

Thanks.

Steve
0 Kudos
Steven_L_Intel1
Employee
1,635 Views
I can't reproduce a problem with these files (I edited the filename but made no other changes.)

My guess is that the data file does not reside at the location specified in the program and therefore the default STATUS='UNKNOWN' created an empty file there. When the empty file is read, you naturally get an EOF error. This happens to a lot of people.
0 Kudos
SteveH
Beginner
1,635 Views
Thanks for your help, Steve. But alas, the file is in the expected location. I will return to this when I have some time-- I'm determined to figure out what simple error I am making. Thanks again.

Steve
0 Kudos
Steven_L_Intel1
Employee
1,635 Views
Make sure that the file in "the expected location" is the one you want. It may be empty.
0 Kudos
Reply