Program is reading direct formatted text file. Each record consist of two character variables and two integer variables. The first record has text in both character variables but the second record has only blanks in the first character variable.
These are the relevant statements used:
OPEN(LUN, FILE=FILNAM, ACCESS='DIRECT', RECL=78,FORM=FORMATTED, STATUS='OLD', IOSTAT=IOST)
I = 0
15 I = I + 1
KREC = IREC + I - 1
READ (LUN, 1001, REC=KREC) MESS, TEXT, NBL, NL
IF (I .EQ. 1) NLINES = NL
IF (NBL .EQ. 0) GO TO 14
DO 8 J=1,NBL
8 WRITE (IWR, 2002)
14 WRITE (IWR, 2001) TEXT
WRITE (IWR, 1002) MESS, TEXT, NBL, NL, I
IF (I .LT. NLINES) GO TO 15
GO TO 19
1001 FORMAT(A5, 1X, A67, I3, I2)
1002 FORMAT(A5, 5X, A67, 5X, I2, 2X, I2, 2X, I3)
2001 FORMAT(1X, A67)
2002 FORMAT(1X)
The first 2 lines (78 characters) of the text file are:
Initz Welcome to the TROP standard table handling module Version 1.0 115
(July 1985). There are four tables of standard data in TROP, for: 0 0
(Note: the ( in the second record starts in the 7th column; the first 0 is in the 76th column)
The first line prints out OK but the second record does not and I assume it is because the first character variable of the second line has only blanks in it. I am using the gnu Fortran77 compiler.
Any help would be greatly appreciated.
These are the relevant statements used:
OPEN(LUN, FILE=FILNAM, ACCESS='DIRECT', RECL=78,FORM=FORMATTED, STATUS='OLD', IOSTAT=IOST)
I = 0
15 I = I + 1
KREC = IREC + I - 1
READ (LUN, 1001, REC=KREC) MESS, TEXT, NBL, NL
IF (I .EQ. 1) NLINES = NL
IF (NBL .EQ. 0) GO TO 14
DO 8 J=1,NBL
8 WRITE (IWR, 2002)
14 WRITE (IWR, 2001) TEXT
WRITE (IWR, 1002) MESS, TEXT, NBL, NL, I
IF (I .LT. NLINES) GO TO 15
GO TO 19
1001 FORMAT(A5, 1X, A67, I3, I2)
1002 FORMAT(A5, 5X, A67, 5X, I2, 2X, I2, 2X, I3)
2001 FORMAT(1X, A67)
2002 FORMAT(1X)
The first 2 lines (78 characters) of the text file are:
Initz Welcome to the TROP standard table handling module Version 1.0 115
(July 1985). There are four tables of standard data in TROP, for: 0 0
(Note: the ( in the second record starts in the 7th column; the first 0 is in the 76th column)
The first line prints out OK but the second record does not and I assume it is because the first character variable of the second line has only blanks in it. I am using the gnu Fortran77 compiler.
Any help would be greatly appreciated.