I’m trying to dump a binary file to disk (consisting of real*4 data values)
and the open statement below gives me an error. Can somebody please
tell me what I’m doing wrong and what the correct statement should be?
Is it anything to do with the record length (recl) specifier, as everything else seems to be standard.
Thanks,
Catherine
PROGRAM DUMP_BIN
IMPLICIT NONE
INTEGER, PARAMETER :: NDATA=132
REAL*4, DIMENSION(NDATA) :: VALUES
INTEGER :: I
open(10,file=‘test.bin’,form=‘unformatted’,access=‘direct’, &
recl=ndata*4,action=‘write’,status=‘replace’,err=100)
do i = 1,ndata
values(i) = i
end do
write(10,rec=1,err=101) (values(i),i=1,ndata)
close(10)
100 STOP ‘PROBLEM OPENING FILE’
101 STOP ‘PROBLEM WRITING FILE’
STOP
END PROGRAM DUMP_BIN