Fortran What does errorfmt mean when running Fortran g77 code?

  • Thread starter Thread starter donnacom
  • Start date Start date
  • Tags Tags
    Code Fortran
Click For Summary
The discussion revolves around a Fortran 77 code compilation issue using g77, where an error occurs during execution related to an input READ statement. The error message indicates a mismatch between the format specified in the code and the actual input data being read. One participant suggests a method to debug the issue by inserting print statements after each READ command to identify which specific statement fails. This approach helps isolate the problem, leading to the discovery that changing the format from (10X,D13.7) to (20X,D13.7) resolves the error, allowing the program to run successfully.
donnacom
Messages
3
Reaction score
0
Hi,
I received a code written in Fortran 77, and I am trying to compile it and run it using g77. It compiles easily with no errors, but I keep getting the following error when I execute

errorfmt: read unexpected character
apparent state: unit 5 named jeffin
last format: (10X,D13.7)
lately reading sequential formatted external IO
Aborted

Any idea what this error means?
 
Technology news on Phys.org
It looks to me like your error is coming from an input READ statement where the format string is in disagreement with what your program is trying to read.

I can't say any more than that because I don't see your code and I don't know what the input was.
 
Sorry, here are the codes I used in the zipped folder. The code JEFF.FOR compiles fine, but I cannot find an error in how the read command takes in the input file called jeffin. If you can help me out, I would really appreciate it!
Donna
 

Attachments

In principle, it's possible to figure out which of your READ statements is failing, by tracing through the code carefully by hand, one statement at a time, and matching each READ statement with a line in your input file to see if the format matches properly.

However, it's easy to make mistakes doing this. Instead, get the computer to do the work for you! :smile:

Immediately after each READ(5... statement, insert a statement which displays the value that it just read in. For example, after

READ(5,99)NEIGEN

add

PRINT *, "NEIGEN = ", NEIGEN

If the appropriate line in your input is actually being read properly, you should see the message

NEIGEN = 2

The last such output line before the error message will tell you which READ statement failed... it's the next one!
 
Thanks!
This really helped. I found the error. I had the format 102 written as (10X,D13.7) and when I put instead (20X, D13.7) it runs.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K