Solving Fortran Error on Linux: invalid number

  • Context: Fortran 
  • Thread starter Thread starter Norman
  • Start date Start date
  • Tags Tags
    Error Fortran Linux
Click For Summary
SUMMARY

The discussion addresses an error encountered while running Fortran code on Linux, specifically the "invalid number: incomprehensible list input" error related to the file NUCLEAR.DAT. The user, Ryan, initially modified the unit number in the OPEN statement to comply with g77's limitations. The issue was resolved by identifying that the .dat file contained virtual characters from its creation in Windows, which were removed using the sed command. This highlights the importance of file compatibility between operating systems when working with Fortran.

PREREQUISITES
  • Understanding of Fortran programming language and its I/O operations
  • Familiarity with g77 and g95 compilers
  • Basic knowledge of Linux command line operations
  • Experience with file format compatibility issues between Windows and Linux
NEXT STEPS
  • Learn how to use sed for text processing in Linux
  • Explore Fortran I/O operations and error handling
  • Research file format differences between Windows and Linux
  • Investigate best practices for porting Fortran code across different operating systems
USEFUL FOR

Fortran developers, software engineers transitioning code between Windows and Linux, and anyone troubleshooting file I/O issues in Fortran applications.

Norman
Messages
895
Reaction score
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
< 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 >
 
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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
8K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 2 ·
Replies
2
Views
9K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K