Solving Fortran Error on Linux: invalid number

In summary, the conversation discusses an error that the speaker encountered while trying to run fortran code on Linux that was originally written for Windows. They mention changing a statement to fix the error and ask for help in understanding its meaning. Eventually, they figure out that the error was caused by virtual characters in the file created on Windows and resolve it by using sed.
  • #1
Norman
897
4
Hi all,

I am trying to run some fortran code on Linux that was originally written (and worked) on Windows.

I am getting the following error:

invalid number: incomprehensible list input
apparent state: unit 63 named NUCLEAR.DAT
last format: list io
lately reading sequential formatted external IO
Aborted

I was in the process of changing a statement OPEN(100, FILE='NUCLEAR.DAT', STATUS='OLD') to OPEN(63, FILE='NUCLEAR.DAT', STATUS='OLD') since I know that g77 doesn't like numbers greater than 99 for unit numbers (as a default). Anyone know what this error means?
Thanks,
Ryan
 
Technology news on Phys.org
  • #2
< guess >
Is the prgm reading any of the file or does it bomb at the open ? If it starts reading the file and bombs at the end you may have an invalid eof in the NUCLEAR.DAT file. Another thing it could be is case sensitivity. I've never seen the error and I port codes between pcs and various flavors of UNIX (including g77 and g95 on linux) routinely.
< /guess >
 
  • #3
I figured it out. The .dat file was created in Windows and it had virtual characters in it. I just had to run sed to get them out of it. Thanks for the help.
Cheers,
Ryan
 

Related to Solving Fortran Error on Linux: invalid number

What is the cause of the "Solving Fortran Error on Linux: invalid number" error?

The most common cause of this error is attempting to perform a mathematical operation with a value that is not a valid number, such as a string or an empty variable.

How can I fix the "invalid number" error in Fortran on Linux?

To fix this error, you will need to carefully review your code and make sure that all variables are properly initialized and assigned valid numerical values. Additionally, you may need to use appropriate data types and conversion functions to ensure that all values used in mathematical operations are valid.

Why is Fortran giving me an "invalid number" error on Linux, but not on other operating systems?

The Fortran compiler and runtime environment can vary between different operating systems, so it is possible that the code is being interpreted differently on Linux compared to other systems. This could be due to differences in default settings or libraries. It is important to test your code on different systems to ensure compatibility.

Can I ignore the "invalid number" error and continue running my Fortran program on Linux?

No, it is not recommended to ignore this error as it indicates a problem with your code that could lead to unexpected results or crashes. It is important to address the error and fix any issues in your code to ensure proper functioning of your program.

How can I prevent the "invalid number" error from occurring in my Fortran code on Linux?

To prevent this error, it is important to carefully validate and sanitize user input, properly initialize and assign values to variables, and use appropriate data types and conversion functions when dealing with numerical values. Additionally, regularly testing and debugging your code can help catch and fix any issues before they result in runtime errors.

Similar threads

  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
5
Views
4K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
6
Views
2K
  • Programming and Computer Science
Replies
2
Views
7K
  • Programming and Computer Science
Replies
4
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
2
Views
8K
Back
Top