clstext Subroutine

private subroutine clstext(lu, rc, status)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: lu
integer, intent(out) :: rc
character(len=*), intent(in), optional :: status

Source Code

    subroutine clstext(lu, rc, status)

      integer,                    intent(in)  :: lu     ! a logical unit to close
      integer,                    intent(out) :: rc     ! the status
      Character(len=*), optional, intent(In)  :: status ! keep/delete

!-----------------------------------------------------------------------
          character(len=6) :: status_
          integer :: iostat

          status_ = 'KEEP'
          If (Present(status)) Then
             Select Case (Trim(status))
             Case ('DELETE','delete')
                status_ = 'DELETE'
             Case  ('KEEP','keep')
                status_ = 'KEEP'
             Case Default
                rc = ESMF_RC_FILE_UNEXPECTED
                return
             End Select
          End If

        close(lu,iostat=iostat,status=status_)
#ifdef _UNICOS
        if(iostat == 0) call asnunit(lu,'-R',iostat) ! remove any attributes
#endif

        rc = ESMF_SUCCESS

    end subroutine clstext