ESMF_UtilIOUnitInit Subroutine

public subroutine ESMF_UtilIOUnitInit(lower, upper, rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in), optional :: lower
integer, intent(in), optional :: upper
integer, intent(out), optional :: rc

Source Code

  subroutine ESMF_UtilIOUnitInit(lower, upper, rc)
!
! !ARGUMENTS:
    integer, intent(in),  optional :: lower
    integer, intent(in),  optional :: upper
    integer, intent(out), optional :: rc
!
! !DESCRIPTION:
!   Initialize non-default range for Fortran I/O unit numbers used
!   within ESMF.
!
!     The arguments are:
!     \begin{description}
!     \item[{[lower]}]
!       A lower bound for Fortran unit numbers.
!     \item[{[upper]}]
!       A upper bound for Fortran unit numbers.
!     \item[{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOPI

    if (present(rc)) rc = ESMF_FAILURE

! Sanity checks

    if (present (lower)) then
      if (lower < 0) return
    end if

    if (present (upper)) then
      if (upper < 0) return
    end if

    if (present (lower) .and. .not. present (upper)) then
      if (lower > ESMF_UtilIOUnitUpper) return
    end if

    if (present (upper) .and. .not. present (lower)) then
      if (upper < ESMF_UtilIOUnitLower) return
    end if

    if (present (upper) .and. present (lower)) then
      if (upper < lower) return
    end if

!

    if (present (lower)) then
      ESMF_UtilIOUnitLower = lower
    end if

    if (present (upper)) then
      ESMF_UtilIOUnitUpper = upper
    end if

    if (present (rc)) rc = ESMF_SUCCESS

  end subroutine ESMF_UtilIOUnitInit