[Info-vax] Text processing examples with Fortran requested
Arne Vajhøj
arne at vajhoej.dk
Sun Nov 15 09:49:25 EST 2009
DTL wrote:
> I'm urgently needing some examples of Fortran code to do text
> processing, mainly reading a file, doing some strings manipulation
> then writing records into a new file.
> I trashed all my DEC stuff five years ago. Too bad...
Silly example:
PROGRAM FCOPY
INTEGER*4 IX
CHARACTER*80 LINE
OPEN(UNIT=1,FILE='ind.txt',STATUS='OLD')
OPEN(UNIT=2,FILE='ud.txt',STATUS='NEW')
100 READ(UNIT=1,FMT=1000,END=300) LINE
IX=80
200 IF(LINE(IX:IX).EQ.' ') THEN
IX=IX-1
GOTO 200
ENDIF
WRITE(UNIT=2,FMT=1100) '>>>>' // LINE(1:IX)
GOTO 100
300 CLOSE(UNIT=2)
CLOSE(UNIT=1)
1000 FORMAT(A)
1100 FORMAT(A)
END
Arne
More information about the Info-vax
mailing list