1. I ran the following file on IBM AIX.
program xxx
real*4 a(13)
.......processing
do j=1,20
write(10)(a(i),i=1,13)
end do
stop
end
2. Then I transfer back to Windows 2000. Try to use Compaq Visual
Fortran 6.6 to read it with the following file:
program xxx
real*4 a(13)
open(11,file='fort.10',status='old',form='unformatted')
do j=1,20
write(10)(a(i),i=1,13)
end do
stop
end
Then error message shows "illegal structure for unformatted".
I've noticed the file size is 1200bytes on IBM AIX.
If I ran the same program in Windows 2000 by Compaq VF6.6, then the
output file size is 1082bytes. If there's no extra data, it should be
4*13*20=1040bytes.
How come there's difference between the outputs of UNIX and Windows
2000?
How to read the unformatted file ran by UNIX by using visual fortran?
Could someone do me a favor?
Thank you very much.
Chien-hui Liu
Jan
Yes, they have opposite endianness, alright. Most of us who have dealt
with both have run into that realization at some point. And don't
expect those record markers to be the same between CVF and XLF for
unformatted record files, either (not that I know for sure that they are
different). That would account for the file size discrepancy, and the
error message about the structure of the file not being valid for CVF.
--
Rob James
> Then error message shows "illegal structure for unformatted".
> I've noticed the file size is 1200bytes on IBM AIX.
> If I ran the same program in Windows 2000 by Compaq VF6.6, then the
> output file size is 1082bytes. If there's no extra data, it should be
> 4*13*20=1040bytes.
> How come there's difference between the outputs of UNIX and Windows
> 2000?
It is most certainly possible to read the file in CVF, but
it will likely take some effort to do so. The court of last
appeal would be to open the file with FORM='BINARY' and
CONVERT='BIG_ENDIAN' in CVF which would allow you to read
the file if you can figure out what the extra data does so
that you could throw it out as it is read. You might find
things to be easier if you could change the kind of file you
write in AIX. If possible, I would look at the documentation
for the OPEN statement on both compilers to see if I could
find some extensions that make the two more compatible. As
alluded to above, the CONVERT and FORM specifiers are what
I would look at on the CVF side; hopefully you can find
something that makes sense on the AIX side. Would be nice
if both sides read and wrote IEEE-754 floating point...