SUBROUTINE SYNOPIN(KSYNP,&
 & KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,&
 & LDMESAGE,LDTAKEN)  

!**** SUBROUTINE SYNOPIN - PROCESS INPUT SYNOP

!        D. VASILJEVIC     ECMWF     13/12/00 (original 04/07/94)

!     PURPOSE
!     -------

!        PROCESS INPUT SYNOP

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

!        CALL SYNOPIN(KSYNP,
!                     KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,
!                     LDMESAGE,LDTAKEN)
!     WHERE:
!            KSYNP   = REPORT POINTER
!            KOBTYP  = OBS. TYPE
!            KCDTYP  = CODE TYPE
!            KOBSQNO = OBS. TYPE SQ. NO.
!            KCDSQNO = CODE TYPE SQ. NO.
!            LDMESAGE= OUTPUT MESSAGE SWITCH  
!            LDTAKEN = REPORT TAKEN ("ODB" REPORT UPDATED) SWITCH  

!        SYNOPIN IS CALLED BY SUBROUTINE ????????

!     METHOD
!     ------

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

!        PRLMCHK  - PRELIMINARY CHECKS
!        GETSETE  - GET/SET BODY ENTRY
!        ERRSTAT  - OBS. ERROR
!        SYNOPBE  - UPDATE SYNOP BODY ENTRY
!        PPVAFL   - PRESSURE/VARIABLE FLAG RESET
!        OBINSTP  - INTSTRUMENT TYPE
!        OBSCHAR  - OBS. CHARACTERISTICS

!     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 YOMANCS  , ONLY :           RADIANS  ,EPSMAC   ,&
 & RTICE    ,RTWAT    ,R2ES     ,R3IES    ,&
 & R3LES    ,R4IES    ,R4LES    ,RTT        
USE YOMCOCTP , ONLY : NSHSCD   ,NABSCD   ,NSHRED   ,&
 & NATSHS   ,NMETAR  ,NPGPS
!-----------------------------------------------------------------------

IMPLICIT NONE

INTEGER(KIND=JPIM),INTENT(IN)    :: KSYNP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOBTYP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCDTYP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOBSQNO 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCDSQNO 
LOGICAL           ,INTENT(INOUT) :: LDMESAGE 
LOGICAL           ,INTENT(OUT)   :: LDTAKEN 
!-----------------------------------------------------------------------


REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "lndsyin.intfb.h"
#include "metarin.intfb.h"
#include "pgpsin.intfb.h"
#include "shipin.intfb.h"

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

#include "fcobs.h"
#include "stmfun_ifs.h"
#include "openmp_obs.h"
!*
!        1.             BRANCH OFF
!                       ----------

IF (LHOOK) CALL DR_HOOK('SYNOPIN',0,ZHOOK_HANDLE)
IF(KCDTYP == NSHSCD .OR. &
   & KCDTYP == NABSCD .OR. &
   & KCDTYP == NSHRED .OR. &
   & KCDTYP == NATSHS       ) THEN  
  CALL SHIPIN (KSYNP,&
   & KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,&
   & LDMESAGE,LDTAKEN)  
ELSEIF(KCDTYP == NMETAR) THEN
  CALL METARIN(KSYNP,&
   & KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,&
   & LDMESAGE,LDTAKEN)
ELSEIF(KCDTYP == NPGPS) THEN
  CALL PGPSIN(KSYNP,&
   & KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,&
   & LDMESAGE,LDTAKEN)
ELSE
  CALL LNDSYIN(KSYNP,&
   & KOBTYP,KCDTYP,KOBSQNO,KCDSQNO,&
   & LDMESAGE,LDTAKEN)  
ENDIF
!*
!-----------------------------------------------------------------------

!        2.             RETURN
!                       ------

2 CONTINUE
IF (LHOOK) CALL DR_HOOK('SYNOPIN',1,ZHOOK_HANDLE)
END SUBROUTINE SYNOPIN
