In Fortran, I am trying to write to an output file from subroutine when the file has open statement in the main program. In other words, how do I pass file unit number (terminal number) to subroutine from the main program. Any idea about this is highly appreciated.For example, my code looks like this,
program main1
open(unit=11,file='output.dat')
call subroutine1
...
call subroutine1
...
end program main1
subroutine subroutine1
write(11,*)'dummy'
...
write(11,*)'dummy'
...
end subroutine subroutine1