!A program using TR and TL in formats and ADVANCE='NO' by Bob Corbett 
!(of Oracle Corporation, formerly Sun). Most compilers get it wrong.
!
!He said:
!
!According to interpretation 000024 of the Fortran 95 standard
!
!Page 136. At the end of the last paragraph of subclause 9.2.1.3.1
! [136:33] add
!   If a nonadvancing output statement leaves a file positioned within
!   the current record and no further output statement is executed
!   for the file before it is closed or a BACKSPACE, ENDFILE, or REWIND
!   statement is executed for it, the file is positioned after the
!   current record before the specified action is performed.
!
!The corresponding statement in the Fortran 2008 standard is
!paragraph 2 of Clause 9.3.4.2.  Based on that statement and
!on paragraph 4 of non-normative Clause C.6.2 of the
!Fortran 2008 standard, my reading is that the output should
!be
!
!ABCDMNOPIJKL
!
!Tobias Burnus (gfortran) disagreed. Bob clarified as follows:
!
!After the first READ statement is executed, the file
!consists of two records:  a formatted record that is the
!sequence of characters "ABCDEFGHIJKL" followed by an
!endfile record.  The file position is within the first
!record between the characters D and E.
!
!After the second WRITE statement is executed, the file
!consists of one record:  a formatted record that is the
!sequence of characters "ABCDMNOPIJKL".  The file position
!is within the record between the characters P and I.  See
!paragraph 4 of Clause 9.3.4.3 and the last sentence of
!paragraph 4 of Clause 9.3.4.4.
!
!If the second WRITE statement had not specified nonadvancing
!output, the file would consist of the same record, but the file
!position would be after the record, not within the record.  See
!paragraph 5 of Clause 9.3.4.4.  The fourth sentence of the
!second paragraph of Clause 9.3.4.2 states
!
!     If a nonadvancing output statement leaves a file
!     positioned within a current record and no further
!     output statement is executed for the file before
!     it is closed or a BACKSPACE, ENDFILE, or REWIND
!     statement is executed for it, the effect is as if
!     the output were the corresponding advancing output
!     statement.
!
!Therefore, after the second REWIND statement is executed, the
!file consists of two records:  A formatted record that is the
!sequence of characters "ABCDMNOPIJKL" followed by an endfile
!record.  The file position is before the first record.
!
!When the second READ statement is executed the variable STR
!is set to "ABCDMNOPIJKL".

     PROGRAM MAIN
        CHARACTER*12 STR
        OPEN (10, FILE='XXX', POSITION='REWIND')
        WRITE (10, '(A)') 'ABCDEFGHIJKL'
        REWIND 10
        READ (10, '(TR4)', ADVANCE='NO')
        WRITE (10, '(TL2, A)', ADVANCE='NO') 'MNOP'
        REWIND 10
        READ (10, '(A)') STR
        PRINT '(A)', STR
      END
