C STRIP TRAILING BLANKS FROM EACH LINE OF A TEXT FILE C 1981-OCT-27 -- JWB -- REVISION 0 C INPUT - FILE 9 C OUTPUT- FILE 10 C CHARACTER*80 LINBUF CHARACTER*1 CHRBUF(80), BLANK EQUIVALENCE (LINBUF,CHRBUF(1)) INTEGER LINLEN LOGICAL EOF, ERRFLG DATA BLANK / ' ' / C C$CCC -------------------------------------------------- C OPEN (9, FORM='FORMATTED', ACCESS='SEQUENTIAL', *STATUS='OLD') OPEN (10, FORM='FORMATTED', ACCESS='SEQUENTIAL', *STATUS='NEW', CARRIAGECONTROL='LIST', RECORDTYPE='VARIABLE') EOF = .FALSE. NLINES = 0 DO UNTIL (EOF) READ (9, 1000, EOF=END, ERRFLG=ERR) LINBUF 1000 FORMAT(A) IF (.NOT.(EOF.OR.ERRFLG)) THEN NLINES = NLINES + 1 LINLEN = 1 DO FOR I=1,80 IF (CHRBUF(I).NE.BLANK) LINLEN = I END FOR WRITE (10,1000) LINBUF(1:LINLEN) IF (MOD(NLINES,100).EQ.0) PRINT *, LINBUF(1:LINLEN) ENDIF END UNTIL PRINT *, NLINES, ' LINES.' STOP END PROGRAM