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

Errors in writing output file using ifort

joanne_crawford
Beginner
665 Views
I am converting some code from NAG to ifort 9.0. I am reading a 9022x3086 1 byte data array and i am using -assume byterecl and increasing my ulimit to do this and it all works fine. I then do some processing on the array that turns it into a 2byte int data array. I then open a file sequentially to write a header and then the data array.



OPEN(unit=nimrod_store(id)%ref, file=TRIM(nimrod_store(id)%name), &

status="replace", action="write", &

access="sequential", form="unformatted")

!

! Write the header data

WRITE(unit=nimrod_store(id)%ref,iostat=ierror_code) &

h%iheader, &

h%rheader, &

h%rheader_specific, &

h%cheader, &

h%iheader_specific

!

! Write the image data

WRITE(unit=nimrod_store(id)%ref,iostat=ierror_code)nimrod_store(id)%data

CLOSE(unit=nimrod_store(id)%ref)



Heres where the weird bit happens. I have checked the contents of my array before writing and i still have a 9022x3086 array and all the data looks fine. But when i check what has been written out the data array is still 9022x3086 but the actual data values have been compressed/reduced somehow to a quarter the size and the rest of the array filled with zeros. I have tried only writing some of the array and i still get this same squashing of the data. Any help would be amazing! Thanks.
0 Kudos
2 Replies
Ron_Green
Moderator
665 Views
Joanne,
I'll contact you via email to get a complete copy of the code to test.
ron
0 Kudos
Ron_Green
Moderator
665 Views

Just as a closure report on this:

The input file was a raw datafile, ie one without record or file marks. To open these, the OPEN statement supports a vendor extension, argument FORM='BINARY'. This allows the FRTL to read these raw data files without expecting record and file markers.

ron

0 Kudos
Reply