Glen Herman
Glen Herman

Reputation: 176

Unclear param in fortran READ method

I am struggling with READ in fortran 77. This code:

      OPEN (UNIT=11,FILE=DRDFIL,ACCESS='DIRECT',
     *      STATUS='OLD',FORM='FORMATTED',RECORD SIZE=360)
      NFRD=1
      READ (11''NFRD,FMT=90019,ERR=11) AO,DHI,B,NR,NC,FS,FAR,ASP,APP,AOP,
     *  AIP,KF,LT,NT,L,H,LS,LEB,TUBETYPE,AIRSIDE,LD

11''NFRD will not compile with Intel Compiler.
The code will continue with this:

11    NFRD=2
      READ (11''NFRD,FMT=90029) A1,B1,C1,D1,A2,B2,C2,D2,E2,A3,B3,
     *  (DRYCF(I),I=1,3),(WETCF(I),I=1,3)

I do not understand what the 11 1 and 11 2 are intending.
The error is:

error #5082: Syntax error, found IDENTIFIER 'NFRD' when expecting one of: :: ) , : * <END-OF-STATEMENT> ; . (/ + - ] /) ' ** > PRIVATE / // ...
      READ (11 NFRD,ERR=11) AO,DHI,B,NR,NC,FS,FAR,ASP,APP,AOP,
---------------^

The opened file is one long space separated string of numbers. Like these:

  0.12066861E+03  0.29457249E-01  0.69446688E+01  0.10000000E+01  0.40000000E+02  0.27042252E+03  0.79557860E+00  0.32429367E+02  0.37945886E+01  0.36223957E+02  0.52160816E+01

This is code from the 1980-90's.

Upvotes: 2

Views: 153

Answers (2)

Michael Ermakov
Michael Ermakov

Reputation: 34

  1. The considered READ operator is compatible with both ifort and ifx Intel compilers (Windows). For that it is only needed to change '' -> ' in the READ operator. Possible, also RECORD SIZE to RECL in the OPEN operator.

  2. An alternate to the UNIT=u, REC=rn form is as follows: READ( u 'rn … ) iolist. https://docs.oracle.com/cd/E19957-01/805-4941/805-4941.pdf

Upvotes: -1

Glen Herman
Glen Herman

Reputation: 176

This code does run and is very old. I found the answer by talking to some engineers. The syntax is an undocumented "feature" and little supported. It is as some commented, a portion of the record. Unit space X, where x is the portion. x+1 is the next portion. Parsed by the format. My compiler does not recognize it, so I am changing the data source. So, it is not gibberish after all.

Upvotes: 0

Related Questions