SUBROUTINE COUPLO4_ENDMPI

!**** *INIOASIS*  - Finalise  coupled mode communication

!     Purpose.
!     --------
!     End communication with OASIS4

!**   Interface.
!     ----------
!       *CALL*  *ENDOASIS4*

!     Input:
!     -----

!     Output:
!     ------

!     Method:
!     ------
!         replace PRISM_DUMMY with PRISM and link & include to OASIS4 libs 
!         for coupled runs

!         PRISM_DUMMY will call MPL_ABORT if LCOUPLO4_ENV

!     Externals:
!     ---------

!     Reference:
!     ---------

!     Author:
!     -------
!     J. Flemming based K. Mogensen's ENDOASIS4   

!     -----------------------------------------------------------

USE PRISM_DUMMY_MOD
USE YOMCT0, ONLY    : LCOUPLO4_ENV
USE PARKIND1  ,ONLY : JPIM,JPRB   
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

IMPLICIT NONE

INTEGER(KIND=JPIM) :: IERR
REAL(KIND=JPRB) :: ZHOOK_HANDLE
!     -----------------------------------------------------------
IF (LHOOK) CALL DR_HOOK('COUPLO4_ENDMPI',0,ZHOOK_HANDLE)
WRITE(*,'(A)')'Finalizing OASIS4'
IF (LCOUPLO4_ENV) THEN
   CALL PRISM_TERMINATE(IERR)
   WRITE(*,'(A,I4)')'Return code : ',IERR
ENDIF
IF (LHOOK) CALL DR_HOOK('COUPLO4_ENDMPI',1,ZHOOK_HANDLE)
END SUBROUTINE COUPLO4_ENDMPI
