You have a small kink due the newlines in your file.. You just have to adjust your record size and format to account for it.. This program will read the first nine records:
Thanks, yep I read somewhere that new line counts for two bytes. So it's food to see what it counts for on a formatted situation thanks.
[code] PROGRAM reader
INTEGER :: a, i
CHARACTER*1 :: nl
OPEN(2, FILE='file.dat', ACCESS='DIRECT', RECL=2, FORM='FORMATTED')
DO i=1, 9
READ( 2, '(I1,A)', REC= i ) a, nl
WRITE(*,*) 'record ', i, ' is ', a
ENDDO
END PROGRAM[/code]
Hope you get it sorted - fortran can be really esoteric, especially when dealing with code written in the 80's.. does my head in..
Tell me about it. Trying to do simple things can be a right PITA!
Thanks, yep I read somewhere that new line counts for two bytes. So it's food to see what it counts for on a formatted situation thanks.
Tell me about it. Trying to do simple things can be a right PITA!