Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Compling of Fortran file aborted

  1. May 20, 2009 #1
    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
     

    Attached Files:

  2. jcsd
  3. May 20, 2009 #2
    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.
     
  4. May 20, 2009 #3
    I add a new line to the end of my data and then I compile it . it give same error again.
     
  5. May 20, 2009 #4
    I ran the program below and it compiled, and ran correctly.

    Code (Text):
          program transfer
          dimension de(400)
    C      DO 5 I=1,400,5
    C    5 read(*,*)(de(j),j=I,I+4)
          read(*,*)(de(j),j=1,400)
          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.
     
  6. May 21, 2009 #5
    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
     
  7. May 21, 2009 #6
    > ... 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.
     
  8. May 21, 2009 #7
    Thank you
    this time it is working.
     
  9. May 21, 2009 #8
    Good to hear that.
    If it is possible at all, could you tell me what changes you made to get it to work?
     
  10. May 22, 2009 #9
    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.
    thanks for your help.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Compling of Fortran file aborted
  1. Write File - Fortran (Replies: 1)

  2. Read file in fortran (Replies: 2)

Loading...