What does errorfmt mean when running Fortran g77 code?

  • Context: Fortran 
  • Thread starter Thread starter donnacom
  • Start date Start date
  • Tags Tags
    Code Fortran
Click For Summary

Discussion Overview

The discussion revolves around an error encountered when executing Fortran 77 code compiled with g77. Participants explore the meaning of the error message related to formatted input/output operations in the context of reading data from an external file.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Conceptual clarification

Main Points Raised

  • One participant describes receiving an error message indicating a mismatch between the expected format and the actual input during a READ operation.
  • Another participant suggests that the error likely arises from a discrepancy between the format string in the READ statement and the data being read from the input file.
  • A participant proposes a method to debug the issue by printing the values read immediately after each READ statement to identify which one fails.
  • A later reply indicates that the participant resolved the issue by adjusting the format from (10X,D13.7) to (20X,D13.7), suggesting that the original format was incorrect for the input data.

Areas of Agreement / Disagreement

Participants generally agree on the approach to diagnosing the error, but there is no consensus on the specific nature of the format issue until one participant resolves it through modification.

Contextual Notes

The discussion does not provide the actual input data or the complete code, which may limit the ability to fully understand the context of the error.

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.
 

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