SUBROUTINE GETSETE(KP,&
 & PREF1,PREF2,PVAL,&
 & PFGERR,PFGCC1,PFGCC2,&
 & PPERR,POERR,PFERR,PRERR,&
 & PFGDEP,PANDEP,&
 & KSTAT,KEVEN1,KEVEN2,KRDBFL,KANFL,&
 & KVFLAG,KPFLAG)  

!**** SUBROUTINE GETSETE - GET/SET BODY ENTRY VALUES

!        D. VASILJEVIC     ECMWF     10/05/01

!     PURPOSE
!     -------

!        GET/SET BODY ENTRY VALUES

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

!        CALL GETSEEN(KP,
!                     PREF1,PREF2,PVAL,
!                     PFGERR,PFGCC1,PFGCC2,
!                     PPERR,POERR,PFERR,PRERR,
!                     PFGDEP,PANDEP,
!                     KSTAT,KEVEN1,KEVEN2,KRDBFL,KANFL,
!                     KVFLAG,KPFLAG
!     WHERE:
!            KP      = BODY ENTRY POINTER
!            PREF1   = VERTICAL COORDINATE 1
!            PREF2   = VERTICAL COORDINATE 2
!            PVAL    = OBSERVED VALUE
!            PFGERR  = FG ERROR
!            PFGCC1  = FG CHECK CONSTATAT 1  
!            PFGCC2  = FG CHECK CONSTATAT 2  
!            PPERR   = PERSISTENCE ERROR
!            POERR   = OBSERVATION ERROR
!            PFERR   = FINAL OBSERVATION ERROR
!            PRERR   = REPRESENTATIVNESS ERROR
!            PFGDEP  = FG DEPARTURE
!            PANDEP  = ANALYSIS DEPARTURE
!            KSTAT   = STATUS
!            KEVEN1  = EVENT 1
!            KEVEN2  = EVENT 2
!            KRDBFL  = RDB FLAGS
!            KANFL   = ANALYSIS FLAGS
!            KVFLAG  = VARIABLE FLAG
!            KPFLAG  = VERTICAL COORIDINATE FLAG

!        GETSETE IS CALLED BY SUBROUTINE ????????

!     METHOD
!     ------

!     EXTERNALS
!     ---------

!     MODIFICATIONS
!     -------------
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      01-Dec-2003 CY28R1 Cleaning 

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

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMDB
USE YOMCMBDY , ONLY : NCMBPFBP ,NCMBVFBP ,NCMBFLBP ,NCMBFLOC
USE YOMANCS  , ONLY :      RMDI     ,RADIANS  ,EPSMAC   ,&
 & RTICE    ,RTWAT    ,R2ES     ,R3IES    ,&
 & R3LES    ,R4IES    ,R4LES    ,RTT  
!-----------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KP 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PREF1 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PREF2 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PVAL 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFGERR 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFGCC1 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFGCC2 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PPERR 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: POERR 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFERR 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PRERR 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PFGDEP 
REAL(KIND=JPRB)   ,INTENT(OUT)   :: PANDEP 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KSTAT 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KEVEN1 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KEVEN2 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KRDBFL 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KANFL 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KVFLAG 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KPFLAG 
!-----------------------------------------------------------------------

REAL(KIND=JPRB) :: ZHOOK_HANDLE

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

#include "fcobs.h"
#include "stmfun_ifs.h"
#include "openmp_obs.h"
!*

!        1.             PRESET
!                       ------

!*
!-----------------------------------------------------------------------

!        2.             GET/SET VALUES
!                       -------------------------

IF (LHOOK) CALL DR_HOOK('GETSETE',0,ZHOOK_HANDLE)
PREF1  = RMDI
PREF2  = RMDI
PVAL   = RMDI

PFGERR = RMDI
PFGCC1 = RMDI
PFGCC2 = RMDI

PPERR  = RMDI
POERR  = RMDI
PFERR  = RMDI
PRERR  = RMDI

PFGDEP = RMDI
PANDEP = RMDI

KSTAT  = ROBODY(KP,MDBDSTA)
KEVEN1 = ROBODY(KP,MDBDEV1)
KEVEN2 = ROBODY(KP,MDBDEV2)
KRDBFL = ROBODY(KP,MDBRDFL)
KANFL  = ROBODY(KP,MDBFLG )

KVFLAG = IBITS(INT(ROBODY(KP,MDBRDFL)),NCMBVFBP+NCMBFLBP,NCMBFLOC)
KPFLAG = IBITS(INT(ROBODY(KP,MDBRDFL)),NCMBPFBP+NCMBFLBP,NCMBFLOC)

!*
!-----------------------------------------------------------------------

IF (LHOOK) CALL DR_HOOK('GETSETE',1,ZHOOK_HANDLE)
END SUBROUTINE GETSETE
