da_get_unit.inc

References to this file elsewhere.
1 subroutine da_get_unit(unit)
2 
3    !-----------------------------------------------------------------------
4    ! Purpose: TBD
5    !-----------------------------------------------------------------------
6  
7    implicit none
8 
9    integer, intent(out) :: unit
10 
11    integer :: i
12 
13    ! Do not trace as called by tracing
14    ! if (trace_use_dull) call da_trace_entry("da_get_unit")
15 
16    unit = -1
17 
18    do i = unit_start, unit_end
19       if (.NOT. unit_used(i)) then
20          unit=i
21          unit_used(i) = .true.
22          exit
23       end if
24    end do
25 
26    if (unit == -1) then
27       call da_error(__FILE__,__LINE__,(/"No free units"/))
28 
29    ! if (trace_use_dull) call da_trace_exit("da_get_unit")
30 
31    end if
32 
33 end subroutine da_get_unit
34 
35