I've been given a program with this basic information:
integer*4 wind(10585,4,17)
open(unit=8,file='swind.dat',form='unformatted',
+ access='direct',recl=4*719780)
write(8,rec=1) wind
It's taking a 3d array and writing it as a single record into the output file. However the file it generates is 11 mb in size. This program was run on UNIX (compiled by gcc) to generate the file and it was a little under 3mb in size.
I did check of the binary contents and noticed this. The files are the same and then this file on the PC is padding a bunch of zeros afterward. It's causing my program that reads this file to return zeros instead of numbers.
My reading program's open/write statements look like this where nbytes is 4*10585 or 42,340 and the irec variable is going from 29 to 44.
open (unit=units(nextop),file=filename,status='old',
&recl=nbytes,access='direct',iostat=istat,form='unformatted')
read (iunit,rec=irec,iostat=istat) (wdata(i),i=1,mxrec)
I'm thinking since the PC version of this file is so much larger than the UNIX version, I'm guessing the writing Fortran program is doing something funny. At the same time, I'm also surprised I'm not getting numbers back from the reading program because the first half of the PC and UNIX files are identical.
Is this a problem with the code or am I missing a compiler flag? I just compiled this program without any additional flags when I created a console program.