Fortran help: writing to a file error

edited November 2008 in Science & Tech
Hi All.
I am computing a quantity within a loop and would like to write it to a file. i am getting a frustrating error (and it is supposed to be a simple thing). Can you guys see where i am going wrong:

open ( unit=40, file='ce')
do J = 0, N2
Ce(J) = D1*dexp(-D3*J*dx)+D2
write (40,200) J, Ce(J)
end do
close (unit=40)

this is the error i am receiving:

write (40,200) J, Ce(J)
^
Undefined label, first referenced at (^)

what am i doing wrong?

Comments

  • QCHQCH Ancient Guru Chicago Area - USA Icrontian
    edited November 2008
    Fortran... hmmmm... Do we have any fortran folks?
  • edited November 2008
    I found a way around it... replaced the 200 with *. working nicely... but still would like to know why it wasn't working in the syntax i posted earlier... if anyone knows i'd appreciate the answer...
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited November 2008
    You don't have a format statement for label 200.

    -drasnor :fold:
  • edited November 2008
    Thanks... but you know, i'm new to fortran and not sure how and where i can put the format statement. care to enlighten me?
Sign In or Register to comment.