Are fortran files read / write semantics different between Fortran77 and Fortran90?

I inherited both the source code and the compiled executable for the Fortran77 program. I do not know which compiler was used to create the existing executable, however I am using GCC 4.9.2. Among other things, the program reads and writes records from / to the binary file. The number of entries is also stored at the beginning of the file.

My problem is that the executable that I compiled incorrectly reads the number of records from the file and therefore throws an error when it tries to read the last record. The binary data file was generated using the existing executable (the one I inherited), and, surprisingly, when I use the existing executable to read from the data file, it works as expected.

My question is, can Fortran READ / WRITE statements distinguish between semantics (e.g. file layout) depending on the platform, fortran version, or compiler type / version?

What does it cost, read and write code

    WRITE(INLIB,REC=1)NPROD,(ELMNTS(K),K=1,ITE),(ATOMWT(KK),KK=1,
 +  ITE),IOUT,INFILE,ITERM,IBM,LINEPR

    READ(INLIB,REC=1)NPROD,(ELMNTS(K),K=1,ITE),(ATOMWT(KK),KK=1,ITE)
 +  ,IOUT,INFILE,ITERM,IBM,LINEPR

NPROD- the number of entries in the file. When I set a breakpoint after the statement READ, I see that it NPRODis about 300,000, when I know that there are only about 2,000 records.

:

    OPEN(UNIT=INLIB,FILE='PRODUCT.BIN',ACCESS='DIRECT',RECL=1188,
 +  STATUS='OLD')

endianess, , , , , ASCII, .

+4

Source: https://habr.com/ru/post/1608802/


All Articles