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

input record too long

schumakov
Beginner
346 Views
Hello all,
My program crashes while reading from a binary file. The open statement looks like this:
open(unit=7,file='itape7',form='unformatted')
and the read statement is as follows:
read (7) (aaa1(n),n=1,ncom1)
where ncom1 = 87,500,005.

I get the following error:

forrtl: severe (22): input record too long, unit 7

The file I'm reading from has records of various lengths that are pre-determined.

Is there a way around it? The compiler version is 8.0.

Thanks in advance,

Sergei

0 Kudos
2 Replies
Steven_L_Intel1
Employee
346 Views
When you use form='unformatted', it is looking for a particular layout of records, with a record length, data, then record length again. If the data in the file is not in this format (see the User's Guide), you may want to use form='binary' instead. Here, the total size of variables in the READ determines how many bytes are transferred.
0 Kudos
schumakov
Beginner
346 Views
Thank you very much, using form='binary' seemed to take care of the problem.
0 Kudos
Reply