[comp.os.vms] Fortran "double spacing"

SUTTON@BRANDEIS.BITNET (03/22/88)

I suspect that you are printing 80 character records to the screen and the text
is being wrapped when tabs are introduced (remember, tabs count as only 1
character in character string).  Try using your program in 132 column mode,
I'll bet you get no wrapping.  What you need to do is figure out how many
characters are in each record and then print only those characters.  You do
this with the Q format control operator.  The following program will print a
file to the screen in the way that you desire.

        PROGRAM TYPEFILE

        CHARACTER*32766 LINE,INFILE*255
        INTEGER LEN

        WRITE(6,'(''+'',A,$)') 'File to be displayed: '
        READ(5,'(A)') INFILE
        OPEN(21,STATUS='OLD',FILE=INFILE)

        READ(21,'(Q,A)',IOSTAT=IOS) LEN,LINE
        DO WHILE(IOS.EQ.0)
            PRINT*, LINE(1:LEN)
            READ(21,'(Q,A)',IOSTAT=IOS) LEN,LINE
        END DO

        CLOSE(21)
        END

SUTTON@BRANDEIS.BITNET