a question about fortran

C wang lotusinwhite at HOTMAIL.COM
Wed Feb 23 13:16:19 EST 2005


Hi, can anybody help me with the question about how to read and write out
files in fortran, I have a file which is bigger than 2G, so I cannot use it
in grads directly, I need to divide it into 2 smaller files, the array of
the original file is A(96,80,14) in 6000 days, if I want to write the file
into 2 files, how can I do? this is what I have done, but it seems not
right,

        open (11,file='a11.dat',form='unformatted',
     &       STATUS='OLD', ACCESS='direct', RECL=IX*IL*4)
          OPEN (UNIT=33, FILE='33.dat', FORM='UNFORMATTED',
     &        ACCESS='DIRECT', RECL=IX*IL*4)
        OPEN (UNIT=44, FILE='44.dat', FORM='UNFORMATTED',
     &        ACCESS='DIRECT', RECL=IX*IL*4)

       IREC=1
       DO jj=1,JSTEPS
       DO k=1,kx
       READ (11, REC=IREC) ((A(I,J,K),J=1,IL),I=1,IX)
       IREC=IIREC+1
       END DO
       END DO
c
       IIREC=1
       DO jj=1,JSTEPS/2
       do k=1,kx
       WRITE (33, REC=IIREC) ((A(I,J,K),J=1,IL),I=1,IX)
       IIREC=IIREC+1
       end do
       END DO

       IIREC=JSTEPS/2+1
       DO jj=JSTEPS/2,JSTEPS
       do k=1,kx
       WRITE (44, REC=IIREC) ((ASAVE(I,J,K),J=1,IL),I=1,IX)
       IIREC=IIREC+1
       end do
       END DO

the error says: A direct access READ statement was executed past the end of
file (unit=11, rec=84001).

Thanks very much!

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee®
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



More information about the gradsusr mailing list