# Compling of Fortran file aborted

• Fortran

## Main Question or Discussion Point

Hi

I want to sort the data in output file by Fortran transfer file.
when I do ./transfer<output>data1
It gives an error message:
invalid number: incomprehensible list input
apparent state: unit 5 (unnamed)
last format: list io
lately reading direct formatted external IO
Aborted
can anybody help me?

thank you
jamshid

#### Attachments

• 1.6 KB Views: 76

Related Programming and Computer Science News on Phys.org
It looks to me that the data file has not been closed correctly. All you need to do is to add a newline to the end of the data file to complete the 80th line and the program should work as posted.

I add a new line to the end of my data and then I compile it . it give same error again.

I ran the program below and it compiled, and ran correctly.

Code:
      program transfer
dimension de(400)
C      DO 5 I=1,400,5
do 10 i=1,400
write(6,*) i,de(i)
10 continue
end
If it is a compilation error, could you indicate the operating system and the compiler's name? Also please indicate if it is F77, F90 or F95.
A compilation should occur before you type ./transfer <output >data1
Also, double check that the executable created is called transfer.exe and not a.out or anything else.
If it is an execution error, you can also modify the code to read 5 numbers per read (80 lines total). Make sure that you have added a newline to the end of the DATA and not the program.

I ran your commands and it produced an executable file as did for me.
I add a line to end of my data as you told, unfortunately, it give error messages:
invalid number: incomprehensible list input
apparent state: unit 5 (unnamed)
last format: list io
lately reading direct formatted external IO
Aborted
For your information, my operation system is Linux fedora 10, 64*84 and my Fortran compiler are g77 and f77.
I am waiting for your new comment.
thanks
jamshid

> ... it produced an executable file ...
Thank you for confirming that the compilation went through with no problem, which infers that the problem is execution.

> ... apparent state: unit 5 (unnamed) ...
Traditional Fortran (F77 and before) uses unit 5 for input. Some compilers accept read(*,*) statements and assign unit 5 automatically. As I do not use g77, I cannot confirm if this applies to g77.

To solve your problem, you have three possibilities, in this order:
1. change the read(*,*) to read(5,*) and see if it solves the problem.
2. If the above does not work, then replace the read statement by uncommenting the two commented lines (do 5...).
Sometimes the compilers get bogged down because of newlines not being at the right places. The commented lines read the lines correctly.
2a. If 2. above does not work, reduce the number of data read from 400 to 395. This will avoid reading the last line and hence any problem associated with it.
3. Open a file and read from the file (for example, using unit1 instead of 5), but the execution line will not require the <output parameter, i.e. just ./transfer >data1.

Let me know how it goes.

Thank you
this time it is working.

Good to hear that.
If it is possible at all, could you tell me what changes you made to get it to work?

there was extra line in data and then I copied data in excel and then paste in new text editor. then I sort the data after that I compile it.