Hi everyone.
I am trying to open several files at once however it is not working and i cannot figure out why. I am writing out several files too and it's working. I'm getting the error that the files cannot be found (29). Thanks for the help
Program open_da
implicit none
Integer :: x,j,z
Character(len=10) :: file1, file2
character(len=2) :: input(j) = (/ '60', '61', '62', '63'... /)
character(len=4) :: output(j) = (/ '1960', '1961', '1962', '63'... /)
opendo: do x=1,j
file2=input(x)//'.txt'
OPEN (UNIT=3, FILE= file2, STATUS='OLD', IOSTAT=status)
openif: if(status==0) then
read(3,10, IOSTAT=status) (day(z), month(z), value(z), z=1,y)
else openif
write(*,1040) status
end if openif
10 FORMAT (I2,A3,F10.4)
1040 format (' ', 'Error opening the file: IOSTAT=', I6)
file1 = output(x)//'.txt'
OPEN(UNIT=1,FILE=file1,STATUS='new',FORM='FORMATTED')
!!! The rest of the program
end do opendo
end program open_da
I am trying to open several files at once however it is not working and i cannot figure out why. I am writing out several files too and it's working. I'm getting the error that the files cannot be found (29). Thanks for the help
Program open_da
implicit none
Integer :: x,j,z
Character(len=10) :: file1, file2
character(len=2) :: input(j) = (/ '60', '61', '62', '63'... /)
character(len=4) :: output(j) = (/ '1960', '1961', '1962', '63'... /)
opendo: do x=1,j
file2=input(x)//'.txt'
OPEN (UNIT=3, FILE= file2, STATUS='OLD', IOSTAT=status)
openif: if(status==0) then
read(3,10, IOSTAT=status) (day(z), month(z), value(z), z=1,y)
else openif
write(*,1040) status
end if openif
10 FORMAT (I2,A3,F10.4)
1040 format (' ', 'Error opening the file: IOSTAT=', I6)
file1 = output(x)//'.txt'
OPEN(UNIT=1,FILE=file1,STATUS='new',FORM='FORMATTED')
!!! The rest of the program
end do opendo
end program open_da