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

forrtl: severe (67): input statement requires too much data,

milenko1976
Beginner
6,045 Views
I am using Intel Composer,now in this program gaves me this:
forrtl: severe (67): input statement requires too much data
In the same program,it has read 2 binary files with no problem.
if(itimes.eq.1)
+open(27, file='rec.in', form='unformatted', status='old')
150 read(27,end=1000) xrec,yrec,zrec,trec,urec,inum

What means too much data?
I made rec.in this way:
write(*, fmt="(/'Enter input file name')")
read(5,85) ifname
85 format(a72)
write(*, fmt="(/'Enter output file name')")
read(5,85) ofname
c
open(unit=11, file=ifname, status='old')
open(unit=12, file=ofname, form='unformatted')
n=0
c
100 read(11,5, end=999) x,y,z,t,u,i
5 format(5f10.3,i3)
write(12) x,y,z,t,u,i

Where is the problem?
0 Kudos
11 Replies
mecej4
Honored Contributor III
6,045 Views
Show the type declarations (and dimensions, if any) for the items of the I/O list:

x,y,z,t,u,i
0 Kudos
milenko1976
Beginner
6,045 Views
Tough question because I have not declare them,nor the original code writer.Actually intention was to make binary from ascii.
Input file,couple of lines:
0.000 1.000 0.020 0.000 0.000 -2
0.250 1.000 0.020 0.000 0.000 -2
0.500 1.000 0.020 0.000 0.000 -2
0.750 1.000 0.020 0.000 0.000 -2
1.000 1.000 0.020 0.000 0.000 -2
1.250 1.000 0.020 0.000 0.000 -2
1.500 1.000 0.020 0.000 0.000 -2
1.750 1.000 0.020 0.000 0.000 -2
2.000 1.000 0.020 0.000 0.000 -2
The formay is 5f10.3,int3.So od -t x4 gives:
0000000 00000018 00000000 3f800000 3ca3d70a
0000020 00000000 00000000 fffffffe 00000018
0000040 00000018 3e800000 3f800000 3ca3d70a
0000060 00000000 00000000 fffffffe 00000018
0000100 00000018 3f000000 3f800000 3ca3d70a
0000120 00000000 00000000 fffffffe 00000018
0000140 00000018 3f400000 3f800000 3ca3d70a
0000160 00000000 00000000 fffffffe 00000018
0000200 00000018 3f800000 3f800000 3ca3d70a
0000220 00000000 00000000 fffffffe 00000018
0000240 00000018 3fa00000 3f800000 3ca3d70a
0000260 00000000 00000000 fffffffe 00000018
0000300 00000018 3fc00000 3f800000 3ca3d70a
0000320 00000000 00000000 fffffffe 00000018

0 Kudos
Ron_Green
Moderator
6,045 Views
There must be some bug in your code, but it's not clear where that is. Your example, as far as I can tell:

program repro
real :: x,y,z,t,u
integer :: i
real :: xr,yr,zr,tr,ur
integer :: ir

open(unit=11, file='rec.txt', status='old')
open(unit=12, file='rec.in', form='unformatted', status='new')

do while(.true.)
100 read(11,5, end=999) x,y,z,t,u,i
5 format(5f10.3,i3)
write(12) x,y,z,t,u,i
end do
999 write(*,*) "file converted, closing files."
close( 11 )
close( 12 )
write(*,*) "re-reading the binary file"
open(27,file='rec.in',form='unformatted', status='old')

do while(.true.)
read(27,end=1000) xr,yr,zr,tr,ur,ir
write(*,*) xr, yr, zr, tr, ur, ir
end do

1000 close(27)
write(*,*) "end of file reached"

end program repro

and I created the input text file "rec.txt":
$ more rec.txt
0.000 1.000 0.020 0.000 0.000 -2
0.250 1.000 0.020 0.000 0.000 -2
0.500 1.000 0.020 0.000 0.000 -2
0.750 1.000 0.020 0.000 0.000 -2
1.000 1.000 0.020 0.000 0.000 -2
1.250 1.000 0.020 0.000 0.000 -2
1.500 1.000 0.020 0.000 0.000 -2
1.750 1.000 0.020 0.000 0.000 -2
2.000 1.000 0.020 0.000 0.000 -2

ifort -g -traceback -o repro repro.f90
rwgreen-mac02:79662 rwgreen$ ./repro
file converted, closing files.
re-reading the binary file
0.0000000E+00 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
0.2500000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
0.5000000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
0.7500000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
1.000000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
1.250000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
1.500000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
1.750000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
2.000000 1.000000 2.0000000E-02 0.0000000E+00 0.0000000E+00
-2
end of file reached


Runs without a problem. This is with the 12.0 compiler, but should work with any older version too.
So you have some bug in your code without the code there is no telling where the bug is. Make sure that label 1000 closes file unit 27, and check the logic flow in your program.

ron
0 Kudos
milenko1976
Beginner
6,045 Views
Thanks Ron,well I have presented just part of the code but I will go through ti again.
0 Kudos
Ron_Green
Moderator
6,045 Views
OK, good luck hunting this down. A few notes: the unformatted data files should be created by the Intel Fortran compiler - other Fortran compilers may use a different binary format for the unformatted file.

You are right to use od to view the file. They are pretty easy to read using od. the "00000018" values are pointers/byte counts to the end of and beginning of the record ( 18 hex = 24 decimal, byte count to end of record or beginning of record (6 data elements of 4 bytes each, 24 byte records). So you will have one length at the start of a record to point to the end, and another length word at the end that points backwards to the start of the record.

For more information, in your documentation search for "Record Types" or look under "User Guide" -> "Building Applications" -> "Data and IO" -> "Fortran IO" -> "Record Types".

I'd look at the END of the unformatted data file and see that a complete record was written.
0 Kudos
Ron_Green
Moderator
6,045 Views
another question: you are using the newest 'Fortran Composer XE 2011' compiler. did this program work with our older compilers like 11.1, 11.0, 10.1, or older?

One other user has said he had problems with unformatted files with this XE 2011 compiler that he did NOT see with 11.1. But his code was too large to give to us. So there may be a bug, but so far we have not had a code that we can use to investigate the possible bug.

ron
0 Kudos
milenko1976
Beginner
6,045 Views
Ron

Well with 11.1 I still had some problems,then I wanted to use f77 then decided to use Intel Fortran again and downloaded XE 2011.I am combing two codes for my Phd.In the first part of the code,there is binary file(array of travel-times),I think that it read it without any problems.
0 Kudos
Clyde_Gumbert
Beginner
6,045 Views
I see no resolution of this problem. I recently got this error with a new input to an old code. What does the error message really mean by "too much data"?
0 Kudos
Steven_L_Intel1
Employee
6,045 Views
It means that you have an unformatted READ statement that has more variables in the I/O list than data in the record. For example, if you wrote the record with four values and you tried to read in five, you'd get this error.
0 Kudos
mecej4
Honored Contributor III
6,045 Views
>unformatted READ statement that has more variables in the I/O list than data in the record

In other words, the number of I/O units of data that the unformatted I/O list calls for in the READ statement is larger than the length of the file record that is being read. Example:

[fortran]program ioerr
integer x(8),y(10),i
do i=1,8
   x(i)=i*i
end do
open(11,file='io.ufd',form='unformatted',status='new')
write(11)x
close(11)
open(12,file='io.ufd',form='unformatted',status='old')
read(12)y
close(12)
end program ioerr
[/fortran]
0 Kudos
Clyde_Gumbert
Beginner
6,045 Views
So it indicates a mismatch between the record length and the expected record length rather than some sort of limit on the record size. Thanks
0 Kudos
Reply