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

Cannot read an unformatted file generated on IBM platform

Ludovic_Sauge1
Beginner
336 Views

Hi all!
This this my first post on the Intel Software Network!

I have an issue using ifort (10.1.015). A simple code read an unformatted file created on an IBM plateform. This is reading and then some results writing on he standart output.
This file is opend using the following statements,

open(10,file=myfile,form='unformatted',access='direct',recl=irecl&
&,convert='big_endian')

The code is compiled using '-assume byterecl' flag.
Unfortunately, the results appear false (including some NaNs!).

But using gfortran, the results are now correct.

Any idea to reproduce the gfortran beahavior with ifort or the unformatted file generatded on the IBM platform is only campatible with gfortran.

Regards,
Ludo

0 Kudos
4 Replies
Ron_Green
Moderator
336 Views
Please show the gfortran open statement and any compiler switches used to specify IO characteristics.

thanks

ron
0 Kudos
TimP
Honored Contributor III
336 Views

Many IBM platforms are little-endian. Some compilers in use on IBM platforms have different direct access file formats, even when the endian-ness matches what you set.

0 Kudos
Ludovic_Sauge1
Beginner
336 Views
Hi ron, thanks for your support.
I compiled the gfortran version without any flag.
Version of gfortran is GNU Fortran (GCC) 4.1.2 20070626 (Red Hat 4.1.2-14)
cheers,
Ludo
0 Kudos
Steven_L_Intel1
Employee
336 Views
I would suggest, then, that this is not a big-endian file and you should try the ifort defaults as well.

You can do an "od -t x4" on the file to examine the record lengths and data layout.
0 Kudos
Reply