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

Binary Big Endian File Problem...

andrea_gavana
Beginner
256 Views
Hello NG,
I have always fought with an error that comes when I try to read unformatted binary files with convert=big_endian. When I try to read more than, say, 1000 values at a time, I always get this error:
input statement requires too much data
Well, that's not true. From the header of the file, I perfectly know how many floating point entries there are in the file. What I basically do is:

open(unit = 1, file = filename, form = 'UNFORMATTED', convert = 'BIG_ENDIAN')

read(1,end=10) MyVector(1:numvalues)

and I get that error. If I use an ugly approach in which I read 1000 values at a time, everything goes smoothly, like:

Code:

iind = int(lastvalue/1000)

do while (mycount <= iind)
    mycount = mycount + 1
    if (mycount <= iind) then
        read(1,end=10) MyVector(1000*(mycount-1)+1:1000*mycount)
    else
        read(1,end=10) MyVector(1000*(mycount-1)+1:lastvalue)
    endif
enddo



This piece of code works, but it's ugly and I am sure slower than the one-liner read. Is there something I can do to avoid that error using the one-liner instruction to read all the values in a shot?

This is IVF 9.0, but it happened also with Compaq visual fortran 6.5...

Thank you very much for your suggestions.

Andrea

0 Kudos
1 Reply
Steven_L_Intel1
Employee
256 Views
Send an example and a description of the problem to Intel Premier Support.
0 Kudos
Reply