The routine GetLUN
finds a valid logical unit number in the
range 1-100. IMPORTANT: This is the minimal-effort version of this
routine, and extremely slow!
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out) | :: | LUN | |||
integer, | optional | :: | RC |
Subroutine GetLUN(LUN,RC) ! ! !USES: ! ! Use Precision_Mod, Only: f4 ! ! !INPUT PARAMETERS: ! ! ! !OUTPUT PARAMETERS: ! Integer, Intent(Out) :: LUN Integer, Optional :: RC ! !----------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: ! Integer :: I, RC_ Logical :: isOpen !================================================================= ! GetLUN starts here! !================================================================= isOpen = .True. LUN = -1 RC_ = 0 Do I = 8,100 Inquire(Unit=I,Opened=isOpen) If (.not.isOpen) Then LUN = I Exit End If End Do If (isOpen) RC_ = -1 If (Present(RC)) RC = RC_ End Subroutine GetLUN