Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing to a file error

Status
Not open for further replies.

Molymoles

Technical User
Sep 29, 2008
3
US
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?
 
Hi Molymoles,

You forgot to define labe 200, which shoud define the output format.
Look at this simple example how it works:

Code:
integer i

open(20,file='cubes.dat')
do i=1,100
  write(20,10)i,i*i,i**3
enddo
close(20)
10 format(i6,i8,i10)
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top