What does errorfmt mean when running Fortran g77 code?

  • Fortran
  • Thread starter donnacom
  • Start date
  • Tags
    Code Fortran
In summary: So I just needed to change the format string in the input.In summary, the code compiled and ran, but an error was encountered when trying to read the input file. The input file had a format string which was not compatible with the code.
  • #1
donnacom
3
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
  • #2
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.
 
  • #3
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

  • Codesused.zip
    4 KB · Views: 277
  • #4
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!
 
  • #5
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.
 

FAQ: What does errorfmt mean when running Fortran g77 code?

What is Fortran g77 code?

Fortran g77 is a programming language commonly used in scientific and engineering applications. It is primarily used for numerical and scientific computing, and is known for its efficiency and speed.

What are some common problems with Fortran g77 code?

Some common problems with Fortran g77 code include syntax errors, compatibility issues with newer versions of Fortran, and difficulties with debugging due to the lack of modern features such as dynamic memory allocation.

How can I fix syntax errors in my Fortran g77 code?

The best way to fix syntax errors is to carefully review your code and check for typos or missing punctuation. You can also use a debugger or compiler to identify the exact location of the error.

How can I make my Fortran g77 code more compatible with newer versions of Fortran?

To make your Fortran g77 code more compatible with newer versions, you can try using a translator or converting your code to a newer version. However, keep in mind that some features may not be available in g77 and may require a significant rewrite.

What are some alternatives to Fortran g77 for scientific computing?

Some alternatives to Fortran g77 for scientific computing include Fortran 90/95, C/C++, and Python. Each language has its own strengths and weaknesses, so it's important to consider your specific needs and requirements when choosing a language for your project.

Similar threads

Replies
2
Views
2K
Replies
2
Views
2K
Replies
8
Views
3K
Replies
16
Views
2K
Replies
2
Views
3K
Replies
7
Views
3K
Replies
6
Views
3K
Replies
4
Views
2K
Replies
6
Views
4K
Back
Top