get_unit Subroutine

public subroutine get_unit(iunit)

Arguments

Type IntentOptional AttributesName
integer(kind=I4), intent(out) :: iunit

Called by

proc~~get_unit~~CalledByGraph proc~get_unit get_unit program~test_solvers test_solvers program~test_solvers->proc~get_unit

Contents

Source Code


Source Code

subroutine get_unit(iunit)
implicit none
integer(kind=I4), intent(out) :: iunit
   integer(kind=I4) :: i
   integer(kind=I4) :: ios
   logical(kind=I4) :: lopen
   iunit = 0
   do i = 10, 99

    if (i /= OUT_U .and. i /= IN_U .and. i /= ERR_U) then
      inquire (unit = i, opened = lopen, iostat = ios)
      if (ios == 0) then
         if ( .not. lopen ) then
            iunit = i
            return
         endif
      endif
    endif

   enddo

return
endsubroutine get_unit