SUBROUTINE REJMV(KOBS,KOBTYP,KCMONM)

!**** SUBROUTINE REJMV - REJECT A MOVING PLATFORM REPORT

!          HEIKKI JARVINEN   ECMWF          15/MAR/1995
!          DRASKO VASILJEVIC ECMWF          21/10/1999

!*    PURPOSE
!     -------

!        REJECT A MOVING PLATFORM REPORT IF IT BELONGS TO THE CURRENT
!     OBSERVATION SET.

!*    INTERFACE
!     ---------

!     ***CALL REJMV(KOBS,KOBTYP,KCMONM)
!     WHERE KOBS   = POINTER TO CURRENT REPORT IN ODB
!           KOBTYP = OBSERVATION TYPE
!           KCMONM = UNIQUE SEQUENCE NUMBER OF REFERENCE REPORT

!        REJMV IS CALLED BY SUBROUTINES REDGL AND THIAIR

!     METHOD
!     ------

!**   EXTERNALS
!     ---------

!**   MODIFICATIONS
!     -------------

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

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK

USE YOMLUN   , ONLY :    NULERR
USE YOMNMEV  , ONLY : NR1EVENT
USE YOMDB

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KOBS 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOBTYP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCMONM 
INTEGER(KIND=JPIM) :: ICMONM, IOBTYP
REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "abor1.intfb.h"

#include "fcobs.h"

#include "openmp_obs.h"
!*
!     ------------------------------------------------------------------

!*       1.       REJECT A REPORT IF IT BELONGS TO NODE
!                 -------------------------------------

!WRITE(NULOUT,'('' *** REMOVE MOVING PLATFORM *'')')
!CALL FLUSH(NULOUT)

!*          1.1   OBSERVATION TYPE

IF (LHOOK) CALL DR_HOOK('REJMV',0,ZHOOK_HANDLE)
IOBTYP = ROBHDR(KOBS,MDBOTP)
IF(IOBTYP /= KOBTYP) GOTO 140

!*          1.2   UNIQUE SEQUENCE NUMBER

ICMONM = ROBHDR(KOBS,MDBONM)
IF(ICMONM /= KCMONM) GOTO 140

!*          1.3    CHANGE REPORT STATUS AND EVENT

ROBHDR(KOBS,MDBRST) = ZCHSTAT_REJECT( ROBHDR(KOBS,MDBRST))
ROBHDR(KOBS,MDBREV1) = ZCHEV1( ROBHDR(KOBS,MDBREV1),NR1EVENT(10))
GOTO 2

!*          1.4    SOMETHING IS BADLY WRONG

140 CONTINUE
WRITE(NULERR,'('' * ERROR IN REJMV: '',&
 & 4(1X,I8))') IOBTYP,KOBTYP,ICMONM,KCMONM  
CALL ABOR1('REJMV: SOMETHING IS BADLY WRONG')
!*
!     ------------------------------------------------------------------

!        2.       RETURN
!                 ------
2 CONTINUE
IF (LHOOK) CALL DR_HOOK('REJMV',1,ZHOOK_HANDLE)
END SUBROUTINE REJMV

