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

write several file

Status
Not open for further replies.

aJCU

Programmer
Joined
May 4, 2007
Messages
5
Location
GB
Hallo everybody,

I would like to write in fortran different input file like:

test_1.inp
test_2.inp
.
.
.
test_50.inp

I would like to do something like this:

do i=1:50
Open(unit=2,access='sequential',file='prova_'i'.inp'
&,status='replace')
end do


but how can I pass from the number i to the text form of i?

thanks
 
Hi aJCU

You can do it like this:

Program test

character*12 str
str = 'Prova_xx.inp'

do i=1,50
write(str(7:8),'(i2.2)') i
open(unit=2,file=str(1:12),status='unknown')
.... !(some code here)
close(unit=2)
enddo

end

Best wishes
GulliPe
 
Hi GulliPe,

thanks again for the advice.
I`m trying to do the same in order to launch those input file but I cannot find the way. What I`m trying to do is soemthing like this:

Program test

character*12 str
str = 'Prova_xx.inp'

Do i=1,50
Write(str(13:14),'(i2.2)') i
Call system('C:\abaqus\6.6-1\exec\abq661.exe job="'str'"')
End do

normallly to launch this program I should type:

Call system('C:\abaqus\6.6-1\exec\abq661.exe job="jobname_5.inp"')


Best Regards,
aJCU
 
I found out:

str2='C:\abaqus\6.6-1\exec\abq661.exe job="plate_crack_xx"'
Do i=5,10
Write(str2(50:51),'(i2.2)') i
Call system(str2(1:52))
End do
thanks

aJCU
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top