finding problem in compling the fortran program

2 views
Skip to first unread message

Neelam Guleria

unread,
Aug 30, 2009, 3:11:29 AM8/30/09
to gg...@googlegroups.com
hi
i m finding problem in compling this program .so plz help me in knowing
whts wrong with the program.

open(unit=2,status='unknown',file='b.dat')

open(unit=1,file='/home/Neelam/parameters/data/spe_para29-8.dat')
integer t,p,ane
n=34
do i=1,n
read(1,20)t(i),p(i),ane(i),bex(i),bet(i),d(i)
20 format(6F12.5)

A=p+ane+1
db=bex-bet

write(2,*)A,db
enddo
stop
end

~

Jimmy

unread,
Aug 31, 2009, 4:16:36 AM8/31/09
to gg...@googlegroups.com
First you need to decide whether the variables t,p,... are integers or
reals, as in your program some are defined as integers and others are
undefined - which default to reals. I note you defined t,p,ane as
integers, but then read them from file with a real format. The following
program should compile, but is unlikely to be what you have in mind.
However, it might help you to proceed.

program temp
implicit none
integer :: n,i
real :: t(34),p(34),ane(34)
real :: bex(34),bet(34),d(34)
real :: a(34),db(34)
!
open(unit=2,status='unknown',file='b.dat')
open(unit=1,file='/home/Neelam/parameters/data/spe_para29-8.dat')
n=34
do i=1,n
read(1,20)t(i),p(i),ane(i),bex(i),bet(i),d(i)
20 format(6F12.5)

A=p+ane+1.0 !sets all elements of A
db=bex-bet !sets all elements of db

write(2,*)A,db
enddo
stop
end program temp

Jimmy.
Reply all
Reply to author
Forward
0 new messages