FREE_FILE Subroutine

public subroutine FREE_FILE(UNIT, RC)

Arguments

Type IntentOptional Attributes Name
integer :: UNIT
integer, intent(out), optional :: RC

Calls

proc~~free_file~~CallsGraph proc~free_file FREE_FILE interface~mapl_assert MAPL_Assert proc~free_file->interface~mapl_assert proc~mapl_return MAPL_Return proc~free_file->proc~mapl_return at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception

Called by

proc~~free_file~~CalledByGraph proc~free_file FREE_FILE proc~mapl_climupdate MAPL_ClimUpdate proc~mapl_climupdate->proc~free_file proc~mapl_esmfstatereadfromfile MAPL_ESMFStateReadFromFile proc~mapl_esmfstatereadfromfile->proc~free_file proc~mapl_genericfinalize MAPL_GenericFinalize proc~mapl_genericfinalize->proc~free_file proc~mapl_genericrecord MAPL_GenericRecord proc~mapl_genericrecord->proc~free_file proc~mapl_genericstatesave MAPL_GenericStateSave proc~mapl_genericstatesave->proc~free_file proc~mapl_genericstatesave->proc~mapl_genericstatesave proc~mapl_genericinitialize MAPL_GenericInitialize proc~mapl_genericinitialize->proc~mapl_esmfstatereadfromfile proc~mapl_genericrefresh MAPL_GenericRefresh proc~mapl_genericrefresh->proc~mapl_esmfstatereadfromfile proc~mapl_genericrefresh->proc~mapl_genericrefresh proc~mapl_genericstaterestore MAPL_GenericStateRestore proc~mapl_genericstaterestore->proc~mapl_esmfstatereadfromfile proc~mapl_genericstaterestore->proc~mapl_genericstaterestore

Source Code

  SUBROUTINE FREE_FILE(UNIT, RC)
    implicit none
    integer         , intent(out), OPTIONAL :: RC

    integer :: UNIT

    if(UNIT < 0) then

      _ASSERT(-UNIT<=LAST_UNIT, 'illegal io unit')
      _ASSERT(MTAKEN(-UNIT), 'illegal io unit')
      MEM_units(-unit)%PREVREC=0

    ELSE

    if (UNIT == STD_OUT_UNIT_NUMBER) return
    if (UNIT /= UNDEF) then
       close(UNIT)

       IF (UNIT.LT.1 .OR. UNIT.GT.LAST_UNIT) THEN
          WRITE (0,*) ' BAD UNIT NUMBER  ZFILCLR  UNIT = ', UNIT
          _RETURN(ESMF_FAILURE)
       ELSE
          TAKEN(UNIT) = .FALSE.
          MTAKEN(UNIT) = .FALSE.
       ENDIF
    end if

    END IF

    _RETURN(ESMF_SUCCESS)
  END SUBROUTINE FREE_FILE