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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help in executing my FORTAN program

Status
Not open for further replies.

vibhava

Programmer
Apr 20, 2008
19
US
hi,
I have two text files. Both files are store in the same folder in C drive along with my program. File 1 have 50 rows , each having 4 different values. File 2 is an already existing file with a list of parameter value for one of a model written in FORTRAN. Now what i am trying to do is:
Step 1. read 1 line from file 1
Step 2. replace one of the lines in file 2 by the line read from file 1 in step 1
Step 3. call and run my model
Step 4. repeat the process for 50 times to run my model with 50 different parameter sets

I wrote a program to do that. It was successfully compiled but on running it is asking to insert a disk in drive D. I think what it is trying to do (and i have no clue why) is that its is trying to write in drive D. can anyone help me out with this problem. is there anyone who done something similar to this and have some code written somewhere for this problem.

any help will be appreciated

thanks
vibhava
 
Please post the lines where you are

1) setting the names of the files to be opened/closed
2) opening the files
 
Thanks for your reply, I tried to debug the program and got a way to bypass the situation. however, i would like to know how to do it properly. my code is given below. While writing in unit 15 (timedelay.in file) if i define few other things like, status,action,IOstat i get the error that please insert disk in drive D. but when i removed all other handle the program is running fine and giving no error. Also in the end when i am trying to create a file in folder (writing results from unit 17 to unit 18) i am getting the same error and the program is asking for disk in drive D.
There is one more small issue i am facing.In the line given below (taken from the same program) what i am trying to do is that my program opens a new folder by name "run(c)" where c is the value of counter. example; i should get folder named run(1), run(2), run(3).....run(50) with each folder storing the output files for 50 different run. What i am gettgin right now is that the program is creating folder run(c) (not passing on the value of c

res=MAKEDIRQQ('C:\WAMView\bnz\WAMSA\run(c)')


Program Morris_Trial1
!Use DFPORT
use DFLIB
Implicit None
Real,Dimension(50) :: vs,ks,vss,kss
Integer :: c,r,d,res
logical :: FEXIST
Integer :: lucode=0.0,sv=20000.0,ktd=0.0,ssv=60.0,ssktd=1.0,lucode2=-99.0
print *, "Enter r:"
read *,r
Do c =1,r
open(16,file='C:\WAMView\bnz\GlobalInputs\sam.txt')
open(15,file='C:\WAMView\bnz\GlobalInputs\timedelay.in')
read(16,*) vs(c),ks(c),vss(c),kss(c)
write(15,'(45X,A,16X,A)'),'Surface','Subsurface'
write(15,'(A,21X,A,2X,A,3X,A,2X,A,2X,A)'),'Description','LandUseCode','velocity','kTimeDelay','Velocity','kTimeDelay'
write(15,'(A,I10,I14,I10,I12,I10)'),"'Isolated Wetland/Depression'",lucode,sv,ktd,ssv,ssktd
write(15,'(A,I9,1F14.2,1F9.2,1F14.2,1F9.2)'),"'DryLand (all other land uses)'",lucode2,vs(c),ks(c),vss(c),kss(c)
close(15)
call system('C:\WAMView\bnz\Blasroute.exe')
Inquire(file='C:\WAMView\bnz\WAMSA\run(c)',EXIST=FEXIST)
if(.not.FEXIST) then
res=MAKEDIRQQ('C:\WAMView\bnz\WAMSA\run(c)')
Endif
open(17,file='C:\WAMView\bnz\LocalOutputs\Reaches\reach000034_33.csv')
open(18,file='C:\WAMView\bnz\WAMSA\run(c)\reach2500.csv',status='new',action='write')
Do d=1,1098
read(17,*)
write(18,*)
End Do
close(17)
close(18)
End Do
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top