Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
13 Views

Namelist read error in DLL project: forrtl: severe (24): end-of-file during read

We are getting an end-of-file during read error when attempting to read any namelist. We have used different namelists, cut them down to just 1 entry for testing, verified file is in correct directory and can be opened, but the end-of file read issue remains.

forrtl: severe (24): end-of-file during read, unit 5, file C:\Users\whoever\ProjectName\sampleNameList.dat, line 4, position 1
Image              PC        Routine            Line        Source
libifcoremd.dll    17FAEB4A  Unknown               Unknown  Unknown

Stack trace terminated abnormally.
Press any key to continue . . .

We created a small sample project to test namelist reads, and that works in its own project, but when the same code is inserted into the larger project it still returns "end-of-file during read".  So it would seem to be something specific to the larger project, or the fact that the small project works in debug testing, but the larger project is tested by compiling the DLL and inserting it into the main application.

Here is the small sample code that works in its own project:

    program mesh
    character(len=20) :: Model

    namelist /NAMELISTTEST/Model
    
    open(unit=3,file='namelist.test',status='unknown')
    
    read(3, NAMELISTTEST, ERR=100)
    
    write(*,*) Model
    goto 101
    
100 write(*,*) 'FILE READ ERROR'
101 continue
    
    end program mesh

Sample namelist file:

&NAMELISTTEST
Model='Unit 7'
/

Another version of the larger project is in a working state on a different computer (Win 7), so maybe someone has knowledge of hiccups with other systems (file permissions, etc)? Currently experiencing this issue on Windows Server 2012 Essentials.

Thanks

0 Kudos
3 Replies
Highlighted
Black Belt
13 Views

If you can manage to attach a

If you can manage to attach a ZIP of a complete project or VS solution that reproduces the problem, we can probably help. The only thing I can think of is that your failing program possibly has already read one line of the file so that the starting token is not seen.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
13 Views

We inserted a REWIND

We inserted a REWIND statement before the READ statement to ensure the file is at the beginning. We also moved the project from Server 2012 to a Win7 computer and got the same results, so we can also eliminate the OS as the problem source. The READ statement had only an ERR specifier, no END specifier. When we add an END specifier, the program no longer crashes, but now it goes to the ERR line. So it still encounters an error while reading the namelist file. Then it crashes at a different read that is not a namelist file, so it seems to be something intrinsic with the READ command. Is there some setting in Visual Studio that could have this effect on the READ command? Thanks again.
0 Kudos
Highlighted
Black Belt
13 Views

No setting. Please try to

No setting. Please try to come up with a test case we can build and run.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos