最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Unclear param in fortran READ method - Stack Overflow

programmeradmin0浏览0评论

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.

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.

Share Improve this question edited 2 days ago Craig 2,4741 gold badge22 silver badges27 bronze badges asked Feb 5 at 17:21 Glen HermanGlen Herman 1762 silver badges12 bronze badges 5
  • 2 11''NFRD is gibberish, but there's far from enough information here for me to guess what was intended. – francescalus Commented Feb 5 at 17:28
  • RECORD SIZE = is not Fortran 77 either. Do you know which compiler used to accept this code? Is this something you found printed somewhere or does it come from somewhere where it actually compiled and ran? – Vladimir F Героям слава Commented Feb 5 at 19:44
  • My guess, given the file is opened as direct access, is that NFRD is somehow indicating the record number to be accessed. But I've never seen syntax anything like this. – Ian Bush Commented Feb 5 at 22:51
  • 1 @IanBush, that would be a reasonable guess. Sun's compiler, the usual culprit for horrifying F77 extensions, allowed a direct record access like unit=11'97 (for record 97 of unit 11). An extra ' and a variable name isn't so far from that. – francescalus Commented Feb 5 at 23:11
  • 1 So you really absolutely need to get this particular code running or do you just need to parse the old data and the code came with it? – Vladimir F Героям слава Commented Feb 6 at 6:34
Add a comment  | 

2 Answers 2

Reset to default 0

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.

  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

发布评论

评论列表(0)

  1. 暂无评论