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

Read from a file

mohdwong2003
Beginner
652 Views
Dear All
I am trying to read data from a file ..
REAL dq(3000,300)
INTEGER n,i

OPEN(11, FILE='C:dqnn.dat',STATUS='old')
cOPEN(13, FILE='C:dq.dat')
nm=1962
im=200

DO n=1, nm
DO i=1, im

READ(11,*)dq(n,i)
cWRITE(13,*)dq(n,i)
ENDDO
ENDDO
END
No error msgs in the program, however when I run I will have this error message
forrtl: severe (59): list-directed I/O syntax error, unit 11, file C:dqnn.dat
Image PC Routine Line Source
dq.exe 00407799 Unknown Unknown Unknown
dq.exe 004075B1 Unknown Unknown Unknown
dq.exe 00406784 Unknown Unknown Unknown
dq.exe 00406BED Unknown Unknown Unknown
dq.exe 00404448 Unknown Unknown Unknown
dq.exe 00403E71 Unknown Unknown Unknown
dq.exe 00401179 Unknown Unknown Unknown
dq.exe 0042A709 Unknown Unknown Unknown
dq.exe 00421A94 Unknown Unknown Unknown
kernel32.dll 77E814C7 Unknown Unknown Unknown
Incrementally linked image--PC correlation disabled.
Press any key to continue
Any Idea about the error??
Thanks
0 Kudos
4 Replies
Jugoslav_Dujic
Valued Contributor II
652 Views
That means that the data in the file are invalid, and don't present valid real number-- perhaps there's a TAB instead of space, comma instead of dot...
Jugoslav
0 Kudos
mohdwong2003
Beginner
652 Views
I tried to make the Dimension as q(i) only and I used a dat file that contains limited data sorted as
1
2
3
.
.
etc.
but it still give error..!!
0 Kudos
Jugoslav_Dujic
Valued Contributor II
652 Views
What are values of n and i when it crashes (you can set a temporary write(*,*) n,i to find out)?
Also, if you're sure that there are n*i lines, pay attention to the last line of the file -- if end-of-file is there, right after the number, read(*) will fail. Just add an empty line at the very end of tile.
Jugoslav
0 Kudos
Steven_L_Intel1
Employee
652 Views
The EOF at the end of the last line should be ok. That was a problem early on in DVF, but we fixed it long ago...
0 Kudos
Reply