SUBROUTINE OBINSSP(PLAT   ,PLON,&
 & KOBTYP ,KCDTYP ,KOTMAP ,KOCMAP ,&
 & KSTID  ,KPHASE ,KCHAN  ,KINS   ,KDPT,&
 & KINSPEC,KINSTP                        )  

!**** SUBROUTINE  OBINSSP - OBS. INSTRUMENT SPECIFICATIONS

!        D. VASILJEVIC     ECMWF     04/07/94

!     PURPOSE
!     -------

!        DEFINE OBS. INSTRUMENT SPECIFICATIONS

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

!        CALL OBINSSP(PLAT   ,PLON,
!                     KOBTYP ,KCDTYP ,KOTMAP ,KOCMAP ,
!                     KSTID  ,KPHASE ,KCHAN  ,KINS   ,KDPT,
!                     KINSPEC,KINSTP                       )
!     WHERE:
!           PLAT    = LATITUDE
!           PLON    = LONGITUDE
!           KOBTYP  = CMA OBS. TYPE
!           KCDTYP  = CMA OBS. CODE TYPE
!           KOTMAP  = MAPPED CMA OBS. TYPE
!           KOCMAP  = MAPPED CMA CODE TYPE
!           KSTID   = STATION ID.
!           KPHASE  = PHASE OF THE FLIGHT
!           KCHAN   = SATELLITE CHANNELS
!           KINS    = SATELLITE INSTRUMENT
!           KDPT    = SATELLITE DATA PROCESSING TEHNIQUE
!           KINSPEC = INSTRUMENT SPECIFIOCATION STORE WORD
!           KINSTP  = INSTRUMENT TYPE

!        OBINSSP IS CALLED BY SUBROUTINES:

!     METHOD
!     ------

!        THE OBS. INSTRUMENT SPECIFICATIONS ARE STORED AT AN
!     APPROPIRIATE PLACE.

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

!        SATEMIS  - SATEM INSTRUMENT SPEC.
!        TOVSLRIS - TOVS LOW RESOLUTION INSTRUMENT SPEC.
!        TOVSHRIS - TOVS HIGH RESOLUTION INSTRUMENT SPEC.

!     MODIFICATIONS
!     -------------
!        M.Hamrud      01-Oct-2003 CY28 Cleaning
!        M.Hamrud      01-Dec-2003 CY28R1 Cleaning 
!        N.Bormann     23-Dec-2004 RARAD becomes LIMB
!        A.Fouilloux   31-Mar-2010 Add NTCWC

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

USE PARKIND1  ,ONLY : JPIM     ,JPRB
USE YOMHOOK   ,ONLY : LHOOK,   DR_HOOK
USE YOMCMHDR , ONLY : NCMITBP  ,NCMITOC  ,NPHFLBP  ,NPHFLOC  ,&
 & NSBI1BP  ,NSBI1OC  ,NSBI2BP  ,NSBI2OC  ,NDK2BP   ,&
 & NDK2OC   ,NDK3BP   ,NDK3OC   ,NDK4BP   ,NDK4OC   ,&
 & NSMI3BP  ,NSMI3OC  ,NSMI2BP  ,NSMI2OC  ,NSMI4BP  ,&
 & NSMI4OC  ,NSMI1BP  ,NSMI1OC  ,NTOAABP  ,NTOAAOC  ,&
 & NTOBBBP  ,NTOBBOC  ,NTOCCBP  ,NTOCCOC  ,NTOVVBP  ,&
 & NTOVVOC  ,NTOWWBP  ,NTOWWOC  ,NTOXXBP  ,NTOXXOC  ,&
 & NTOYYBP  ,NTOYYOC  ,NTOZZBP  ,NTOZZOC  
USE YOMANCS  , ONLY : NMDI     ,NBITS    ,RADIANS  ,RTT      ,&
 & R2ES     ,R3LES    ,R3IES    ,R4LES    ,R4IES    ,&
 & RTWAT    ,RTICE    ,EPSMAC  
USE YOMINSTP , ONLY : NSYNINTP ,NSHPINTP ,NACFINTP ,NSTBITGO ,&
 & NSTBITME ,NSTBITIN ,NSTBITJA  
USE YOMLIM   , ONLY : NSTBSID1 ,NSTBSID2 ,NSTBSID3 ,NSTBSID4 ,NSTBSID5, &
 & NSTBSID_TERRA,NSTBSID_AQUA
USE YOMNMCOD , ONLY : NSBI1    ,NSBI2I2
USE YOMCOCTP , ONLY : NSYNOP   ,NSRSCD   ,NATSCD   ,NAIREP   ,&
 & NSATOB   ,NDRIBU   ,NTEMP    ,NPILOT   ,NSATEM   ,&
 & NSTMCD   ,NSTOVS   ,NSTRO3   ,NGTHRB   ,NGTHR1   ,&
 & NGTHR2   ,NSSMI    ,NPAOB    ,NSCATT   ,NLIMB    , NTCWC
USE YOMLUN   , ONLY : NULOUT

IMPLICIT NONE

REAL(KIND=JPRB)   ,INTENT(IN)    :: PLAT 
REAL(KIND=JPRB)   ,INTENT(IN)    :: PLON 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOBTYP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCDTYP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOTMAP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KOCMAP 
INTEGER(KIND=JPIM),INTENT(IN)    :: KSTID 
INTEGER(KIND=JPIM),INTENT(INOUT) :: KPHASE 
INTEGER(KIND=JPIM),INTENT(IN)    :: KCHAN 
INTEGER(KIND=JPIM),INTENT(IN)    :: KINS 
INTEGER(KIND=JPIM),INTENT(IN)    :: KDPT 
INTEGER(KIND=JPIM),INTENT(INOUT) :: KINSPEC 
INTEGER(KIND=JPIM),INTENT(OUT)   :: KINSTP 
INTEGER(KIND=JPIM) :: I_KBCDTYP
INTEGER(KIND=JPIM) :: I1, I2I2, IA, IABO, IABP, IB, IBBO, IBBP,&
 & IBOI1, IBOI2I2, IBOINTP, IBOK2, IBOK3, IBOK4, &
 & IBOPHFL, IBPI1, IBPI2I2, IBPINTP, IBPK2, &
 & IBPK3, IBPK4, IBPPHFL, IC, ICBO, ICBP, II1, &
 & II1BO, II1BP, II2I2, II2I2BO, II2I2BP, II3, &
 & II3BO, II3BP, II4, II4BO, II4BP, IIS, IK2, &
 & IK3, IK4, IV, IVBO, IVBP, IW, IWBO, IWBP, &
 & IX, IXBO, IXBP, IY, IYBO, IYBP, IZ, IZBO, &
 & IZBP

LOGICAL :: LLMESAGE, LLMESLE1, LLMESLE2

REAL(KIND=JPRB) :: ZHOOK_HANDLE

#include "abor1.intfb.h"
#include "satemis.intfb.h"
#include "tovshris.intfb.h"
#include "tovslris.intfb.h"

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

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

!        0.             PRESET
!                       ------

!*          0.1         MAP OBS. CODE TYPE INTO SQ. NO. (ALREADY DONE)

!*          0.2         INSTRUMENT TYPE

IF (LHOOK) CALL DR_HOOK('OBINSSP',0,ZHOOK_HANDLE)
KINSTP = NMDI

!*          0.3         LOGICAL SWITCHES

LLMESAGE = .FALSE.
LLMESLE1 = .FALSE.
LLMESLE2 = .FALSE.
!*
!-----------------------------------------------------------------------

!        1.             SYNOP INSTRUMENT SPECIFICATIONS
!                       -------------------------------

IF(KOBTYP == NSYNOP)          THEN

!*          1.1         DEFINE INS. TYPE

!*          1.1.1       LAND STATIONS

  IF(KCDTYP == NSRSCD.OR.KCDTYP == NATSCD    )      THEN
    KINSTP  = NSYNINTP

!*          1.1.2       SEA STATIONS (SHIPS)

  ELSE
    KINSTP  = NSHPINTP
  ENDIF

!*          1.2         STORE INS. TYPE

!*          1.2.1       CHECK IF BIT STRUCTURE DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )       THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          1.2.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
    WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
    WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
    LLMESAGE = .TRUE.
    LLMESLE2 = .TRUE.
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF
!*
!-----------------------------------------------------------------------

!        2.             AIREP INSTRUMENT SPECIFICATIONS
!                       -------------------------------

!                       INSTRUMENT SPECIFICATION WORD SHOULD HAVE
!                       THE FORMAT (BIT 0 IS RIGHTMOST BIT, WHEREAS
!                       BIT 31 IS LEFTMOSTBIT):
!                       BITS  0- 9 - INSTRUMENT TYPE
!                            10-19 - PHASE OF THE FLIGHT
!                            20-31 - 0 (RESERVED)

ELSEIF(KOBTYP == NAIREP)     THEN

!*          2.1         INST. TYPE

  KINSTP  = NACFINTP

!*          2.1.1       CHECK IF BITS DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )       THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          2.1.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
    WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
    WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
    LLMESAGE = .TRUE.
    LLMESLE2 = .TRUE.
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF

!*          2.2         PHASE OF THE FLIGHT

!*          2.2.1       CHECK IF BITS DEFINED

  IBPPHFL = NPHFLBP(KOCMAP       )
  IBOPHFL = NPHFLOC(KOCMAP       )
  IF(IBPPHFL == NMDI.OR.IBOPHFL == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR FLIGHT PHASE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          2.2.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KPHASE > NBITS (IBOPHFL))   THEN
    WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FLIGHT PHASE LONGER THEN NO. OF BITS'','' RESERVED'')')
    WRITE(NULOUT,'('' FL. PHASE  :'',I10)')   KPHASE
    WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOPHFL
    LLMESAGE = .TRUE.
    LLMESLE2 = .TRUE.
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOPHFL),IBPPHFL)
    KPHASE   = NBITS (IBOPHFL)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KPHASE,IBPPHFL)
  ENDIF
!*
!-----------------------------------------------------------------------

!        3.             SATOB INSTRUMENT SPECIFICATIONS
!                       -------------------------------

ELSEIF(KOBTYP == NSATOB)     THEN

!*          3.0         BIT DEFINITION

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IBPI1   = NSBI1BP(KOCMAP       )
  IBOI1   = NSBI1OC(KOCMAP       )
  IBPI2I2 = NSBI2BP(KOCMAP       )
  IBOI2I2 = NSBI2OC(KOCMAP       )

!*          3.1         FIND OUT INS. TYPE AND I1/I2I2 PARAMETERS
!                       FROM STATION ID

  KINSTP  = NMDI
  I1      = NMDI
  I2I2    = NMDI
  IF(KSTID /= NMDI)                  THEN
    IF(KSTID < NSTBSID1)              THEN
      KINSTP = NSTBITME
      I1     = NSBI1  ( 1)
      I2I2   = NSBI2I2( 1)
    ELSEIF(KSTID < NSTBSID2)         THEN
      KINSTP = NSTBITJA
      I1     = NSBI1  ( 2)
      I2I2   = NSBI2I2( 4)
    ELSEIF(KSTID < NSTBSID3 .OR. KSTID == NSTBSID_TERRA &
    &   .OR. KSTID == NSTBSID_AQUA)         THEN
      KINSTP = NSTBITGO
      I1     = NSBI1  ( 3)
      I2I2   = NSBI2I2( 3)
    ELSEIF(KSTID >= NSTBSID4.AND.KSTID < NSTBSID5     )    THEN
      KINSTP = NSTBITIN
      I1     = NSBI1  ( 5)
      I2I2   = NSBI2I2( 5)
    ELSE
      WRITE(NULOUT,'(''0WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' UNKNOWN STATION ID:'',I10)')   KSTID
      WRITE(NULOUT,'('' OBS. TYPE         :'',I10)')   KOBTYP
      WRITE(NULOUT,'('' CODE TYPE         :'',I10)')   KCDTYP
      WRITE(NULOUT,'('' LATITUDE          :'',F10.2)') PLAT
      WRITE(NULOUT,'('' LONGITUDE         :'',F10.2)') PLON
      WRITE(NULOUT,'('' INS. TYPE/I1/I2I2 SET TO MISSING'')')
    ENDIF
  ENDIF

!*          3.2         STORE INST. TYPE

!*          3.2.1       CHECK IF BIT STRUCTURE DEFINED

  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          3.2.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KSTID /= NMDI)                  THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF

!*          3.3         STORE I1 PARAMETER

!*          3.3.1       CHECK IF BITS DEFINED

  IF(IBPI1   == NMDI.OR.IBOI1   == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR I1 PARAM.'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          3.3.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(I1     > NBITS (IBOI1  ))   THEN
    IF(KSTID /= NMDI)                  THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' I1 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' I1         :'',I10)')   I1
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOI1
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOI1  ),IBPI1  )
  ELSE
    KINSPEC  = INSERT(KINSPEC,I1,IBPI1  )
  ENDIF

!*          3.4         STORE I2I2 PARAMETER

!*          3.4.1       CHECK IF BIT STRUCTURE DEFINED

  IF(IBPI2I2 == NMDI.OR.IBOI2I2 == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR I2I2 PARAM.'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          3.4.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(I2I2   > NBITS (IBOI2I2))   THEN
    IF(KSTID /= NMDI)                  THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' I2I2 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' I2I2       :'',I10)')   I2I2
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOI2I2
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOI2I2),IBPI2I2)
  ELSE
    KINSPEC  = INSERT(KINSPEC,I2I2,IBPI2I2)
  ENDIF
!*
!-----------------------------------------------------------------------

!        4.             DRIBU INSTRUMENT SPECIFICATIONS
!                       -------------------------------

ELSEIF(KOBTYP == NDRIBU)     THEN

!*          4.0         BIT DEFINITION

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IBPK2   = NDK2BP (KOCMAP       )
  IBOK2   = NDK2OC (KOCMAP       )
  IBPK3   = NDK3BP (KOCMAP       )
  IBOK3   = NDK3OC (KOCMAP       )
  IBPK4   = NDK4BP (KOCMAP       )
  IBOK4   = NDK4OC (KOCMAP       )

!*          4.1         FIND OUT INS. TYPE AND K2/K3/K4 PARAMETERS
!                       (NONE ARE DEFINED)

  IK2     = NMDI
  IK3     = NMDI
  IK4     = NMDI

!*          4.2         STORE INST. TYPE

!*          4.2.1       CHECK IF BITS DEFINED

  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI     )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          4.2.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KINSTP /= NMDI)              THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF

!*          4.3         STORE K2 PARAMETER

!*          4.3.1       CHECK IF BITS DEFINED

  IF(IBPK2   == NMDI.OR.IBOK2   == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR K2 PARAM.'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          4.3.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(IK2    > NBITS (IBOK2  ))   THEN
    IF(IK2 /= NMDI)                 THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' K2 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' K2         :'',I10)')   IK2
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOK2
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOK2  ),IBPK2  )
  ELSE
    KINSPEC  = INSERT(KINSPEC,IK2,IBPK2  )
  ENDIF

!*          4.4         STORE K3 PARAMETER

!*          4.4.1       CHECK IF BITS DEFINED

  IF(IBPK3   == NMDI.OR.IBOK3   == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR K3 PARAM.'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          4.4.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(IK3    > NBITS (IBOK3  ))   THEN
    IF(IK3 /= NMDI)                 THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' K3 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' K3         :'',I10)')   IK3
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOK3
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOK3  ),IBPK3  )
  ELSE
    KINSPEC  = INSERT(KINSPEC,IK3,IBPK3  )
  ENDIF

!*          4.5         STORE K4 PARAMETER

!*          4.5.1       CHECK IF BITS DEFINED

  IF(IBPK4   == NMDI.OR.IBOK4   == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR K4 PARAM.'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          4.5.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(IK4    > NBITS (IBOK4  ))   THEN
    IF(IK3 /= NMDI)                 THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' K4 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' K4         :'',I10)')   IK4
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOK4
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOK4  ),IBPK4  )
  ELSE
    KINSPEC  = INSERT(KINSPEC,IK4,IBPK4  )
  ENDIF
!*
!-----------------------------------------------------------------------

!        5.             TEMP INSTRUMENT SPECIFICATIONS
!                       ------------------------------

ELSEIF(KOBTYP == NTEMP )     THEN

!*          5.1         INST. TYPE

!*          5.1.1       CHECK IF BIT STRUCTURE DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          5.1.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KINSTP /= NMDI)              THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF
!*
!-----------------------------------------------------------------------

!        6.             PILOT INSTRUMENT SPECIFICATIONS
!                       -------------------------------

ELSEIF(KOBTYP == NPILOT)     THEN

!*          6.1         INST. TYPE

!*          6.1.1       CHECK IF BIT STRUCTURE DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          6.1.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KINSTP /= NMDI)              THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF

!*          6.2         A4 PARAMETER

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

!        7.             SATEM INSTRUMENT SPECIFICATIONS
!                       -------------------------------

ELSEIF(KOBTYP == NSATEM)     THEN

!*          7.1         SATEM/LOW RES. TOVS

  IF(KCDTYP == NSTMCD)          THEN
    II3   = NMDI
    II4   = NMDI
    II2I2 = NMDI
    II1   = NMDI
    IIS   = NMDI
    CALL SATEMIS(KINS,KDPT,KSTID,II3,II4,II2I2,II1,IIS   )

!*          7.1.1       INST. TYPE

    KINSTP  = IIS

!*          7.1.1.1     CHECK IF BIT STRUCTURE DEFINED

    IBPINTP = NCMITBP(KOCMAP,KOTMAP)
    IBOINTP = NCMITOC(KOCMAP,KOTMAP)
    IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR INS. TYPE'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.1.1.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(KINSTP > NBITS (IBOINTP))   THEN
      IF(KINSTP /= NMDI)              THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
    ENDIF

!*          7.1.2       I3 PARAMETER

!*          7.1.2.1     CHECK IF BIT STRUCTURE DEFINED

    II3BP   = NSMI3BP(KOCMAP       )
    II3BO   = NSMI3OC(KOCMAP       )
    IF(II3BP   == NMDI.OR.II3BO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR I3 PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.1.2.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(II3    > NBITS (II3BO  ))   THEN
      IF(II3 /= NMDI)                 THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' I3 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' I3         :'',I10)')   II3
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   II3BO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (II3BO  ),II3BP  )
    ELSE
      KINSPEC  = INSERT(KINSPEC,II3   ,II3BP  )
    ENDIF

!*          7.1.3       I4 PARAMETER

!*          7.1.3.1     CHECK IF BIT STRUCTURE DEFINED

    II4BP   = NSMI4BP(KOCMAP       )
    II4BO   = NSMI4OC(KOCMAP       )
    IF(II4BP   == NMDI.OR.II4BO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR I4 PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.1.3.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(II4    > NBITS (II4BO  ))   THEN
      IF(II4 /= NMDI)                 THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' I4 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' I4         :'',I10)')   II4
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   II4BO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (II4BO  ),II4BP  )
    ELSE
      KINSPEC  = INSERT(KINSPEC,II4   ,II4BP  )
    ENDIF

!*          7.1.4       I2I2 PARAMETER

!*          7.1.4.1     CHECK IF BIT STRUCTURE DEFINED

    II2I2BP   = NSMI2BP(KOCMAP       )
    II2I2BO   = NSMI2OC(KOCMAP       )
    IF(II2I2BP == NMDI.OR.II2I2BO == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR I2I2 PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.1.4.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(II2I2  > NBITS (II2I2BO))   THEN
      IF(II2I2 /= NMDI)               THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' I2I2 PARAM. LONGER THEN NO. OF BITS'',&
         & '' RESERVED'')')  
        WRITE(NULOUT,'('' I2I2       :'',I10)')   II2I2
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   II2I2BO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (II2I2BO),II2I2BP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,II2I2 ,II2I2BP)
    ENDIF

!*          7.1.5       I1 PARAMETER

!*          7.1.5.1     CHECK IF BIT STRUCTURE DEFINED

    II1BP   = NSMI1BP(KOCMAP       )
    II1BO   = NSMI1OC(KOCMAP       )
    IF(II1BP   == NMDI.OR.II1BO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR I1 PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.1.5.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(II1    > NBITS (II1BO  ))   THEN
      IF(II1 /= NMDI)                 THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' I1 PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' I1         :'',I10)')   II1
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   II1BO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (II1BO  ),II1BP  )
    ELSE
      KINSPEC  = INSERT(KINSPEC,II1   ,II1BP  )
    ENDIF

!*          7.2         LOW RESOLUTION TOVS

  ELSEIF(KCDTYP == NSTOVS)     THEN
    IA = NMDI
    IB = NMDI
    IC = NMDI
    IV = NMDI
    IW = NMDI
    IX = NMDI
    IY = NMDI
    IZ = NMDI
    CALL TOVSLRIS(I_KBCDTYP,KINS,KDPT,IA,IB,IC,IV,IW,IX,IY,IZ )

!*          7.2.1       INST. TYPE

!*          7.2.1.1     CHECK IF BIT STRUCTURE DEFINED

    IBPINTP = NCMITBP(KOCMAP,KOTMAP)
    IBOINTP = NCMITOC(KOCMAP,KOTMAP)
    IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR INS. TYPE'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.1.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(KINSTP > NBITS (IBOINTP))   THEN
      IF(KINSTP /= NMDI)              THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
    ENDIF

!*          7.2.2       A PARAMETER

!*          7.2.2.1     CHECK IF BIT STRUCTURE DEFINED

    IABP   = NTOAABP(KOCMAP       )
    IABO   = NTOAAOC(KOCMAP       )
    IF(IABP   == NMDI.OR.IABO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR A PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.2.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IA    > NBITS (IABO  ))   THEN
      IF(IA /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' A PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' A          :'',I10)')   IA
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IABO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IABO   ),IABP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IA    ,IABP   )
    ENDIF

!*          7.2.3       B PARAMETER

!*          7.2.3.1     CHECK IF BIT STRUCTURE DEFINED

    IBBP   = NTOBBBP(KOCMAP       )
    IBBO   = NTOBBOC(KOCMAP       )
    IF(IBBP   == NMDI.OR.IBBO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR B PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.3.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IB    > NBITS (IBBO  ))   THEN
      IF(IB /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' B PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' B          :'',I10)')   IB
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBBO   ),IBBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IB    ,IBBP   )
    ENDIF

!*          7.2.4       C PARAMETER

!*          7.2.4.1     CHECK IF BIT STRUCTURE DEFINED

    ICBP      = NTOCCBP(KOCMAP       )
    ICBO      = NTOCCOC(KOCMAP       )
    IF(ICBP    == NMDI.OR.ICBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR C PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.4.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IC     > NBITS (ICBO   ))   THEN
      IF(IC /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' IC PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' IC         :'',I10)')   IC
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   ICBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (ICBO   ),ICBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IC    ,ICBP   )
    ENDIF

!*          7.2.5       V PARAMETER

!*          7.2.5.1     CHECK IF BIT STRUCTURE DEFINED

    IVBP    = NTOVVBP(KOCMAP       )
    IVBO    = NTOVVOC(KOCMAP       )
    IF(IVBP    == NMDI.OR.IVBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR V PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.5.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IV     > NBITS (IVBO   ))   THEN
      IF(IV /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' V PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' V          :'',I10)')   IV
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IVBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IVBO   ),IVBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IV    ,IVBP   )
    ENDIF

!*          7.2.6       W PARAMETER

!*          7.2.6.1     CHECK IF BIT STRUCTURE DEFINED

    IWBP    = NTOWWBP(KOCMAP       )
    IWBO    = NTOWWOC(KOCMAP       )
    IF(IWBP    == NMDI.OR.IWBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR W PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.6.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IW     > NBITS (IWBO   ))   THEN
      IF(IW /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' W PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' W          :'',I10)')   IW
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IWBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IWBO   ),IWBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IW    ,IWBP   )
    ENDIF

!*          7.2.7       X PARAMETER

!*          7.2.7.1     CHECK IF BIT STRUCTURE DEFINED

    IXBP    = NTOXXBP(KOCMAP       )
    IXBO    = NTOXXOC(KOCMAP       )
    IF(IXBP    == NMDI.OR.IXBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR X PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.7.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IX     > NBITS (IXBO   ))   THEN
      IF(IX /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' X PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' X          :'',I10)')   IX
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IXBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IXBO   ),IXBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IX    ,IXBP   )
    ENDIF

!*          7.2.8       Y PARAMETER

!*          7.2.8.1     CHECK IF BIT STRUCTURE DEFINED

    IYBP    = NTOYYBP(KOCMAP       )
    IYBO    = NTOYYOC(KOCMAP       )
    IF(IYBP    == NMDI.OR.IYBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Y PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.8.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IY     > NBITS (IYBO   ))   THEN
      IF(IY /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Y PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Y          :'',I10)')   IY
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IYBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IYBO   ),IYBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IY    ,IYBP   )
    ENDIF

!*          7.2.9       Z PARAMETER

!*          7.2.9.1     CHECK IF BIT STRUCTURE DEFINED

    IZBP    = NTOZZBP(KOCMAP       )
    IZBO    = NTOZZOC(KOCMAP       )
    IF(IZBP    == NMDI.OR.IZBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Z PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.2.9.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IZ     > NBITS (IZBO   ))   THEN
      IF(IZ /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Z PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Z          :'',I10)')   IZ
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IZBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IZBO   ),IZBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IZ    ,IZBP   )
    ENDIF

!*          7.3         HIGH RESOLUTION TOVS/RTOVS

  ELSEIF(KCDTYP == NGTHR2.OR.KCDTYP == NGTHR1    ) THEN
    IA = 0
    IB = 0
    IC = 0
    IV = 0
    IW = 0
    IX = 0
    IY = 0
    IZ = 0
    CALL TOVSHRIS(KCHAN,KDPT,&
     & IA,IB,IC,IV,IW,IX,IY,IZ       )  

!*          7.3.1       INST. TYPE

!*          7.3.1.1     CHECK IF BIT STRUCTURE DEFINED

    IBPINTP = NCMITBP(KOCMAP,KOTMAP)
    IBOINTP = NCMITOC(KOCMAP,KOTMAP)
    IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR INS. TYPE'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.1.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(KINSTP > NBITS (IBOINTP))   THEN
      IF(KINSTP /= NMDI)              THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
    ENDIF

!*          7.3.2       A PARAMETER

!*          7.3.2.1     CHECK IF BIT STRUCTURE DEFINED

    IABP   = NTOAABP(KOCMAP       )
    IABO   = NTOAAOC(KOCMAP       )
    IF(IABP   == NMDI.OR.IABO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR A PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.2.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IA    > NBITS (IABO  ))   THEN
      IF(IA /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' A PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' A          :'',I10)')   IA
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IABO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IABO   ),IABP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IA    ,IABP   )
    ENDIF

!*          7.3.3       B PARAMETER

!*          7.3.3.1     CHECK IF BIT STRUCTURE DEFINED

    IBBP   = NTOBBBP(KOCMAP       )
    IBBO   = NTOBBOC(KOCMAP       )
    IF(IBBP   == NMDI.OR.IBBO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR B PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.3.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IB    > NBITS (IBBO  ))   THEN
      IF(IB /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' B PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' B          :'',I10)')   IB
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBBO   ),IBBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IB    ,IBBP   )
    ENDIF

!*          7.3.4       C PARAMETER

!*          7.3.4.1     CHECK IF BIT STRUCTURE DEFINED

    ICBP      = NTOCCBP(KOCMAP       )
    ICBO      = NTOCCOC(KOCMAP       )
    IF(ICBP    == NMDI.OR.ICBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR C PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.4.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IC     > NBITS (ICBO   ))   THEN
      IF(IC /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' IC PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' IC         :'',I10)')   IC
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   ICBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (ICBO   ),ICBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IC    ,ICBP   )
    ENDIF

!*          7.3.5       V PARAMETER

!*          7.3.5.1     CHECK IF BIT STRUCTURE DEFINED

    IVBP    = NTOVVBP(KOCMAP       )
    IVBO    = NTOVVOC(KOCMAP       )
    IF(IVBP    == NMDI.OR.IVBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR V PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.5.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IV     > NBITS (IVBO   ))   THEN
      IF(IV /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' V PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' V          :'',I10)')   IV
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IVBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IVBO   ),IVBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IV    ,IVBP   )
    ENDIF

!*          7.3.6       W PARAMETER

!*          7.3.6.1     CHECK IF BIT STRUCTURE DEFINED

    IWBP    = NTOWWBP(KOCMAP       )
    IWBO    = NTOWWOC(KOCMAP       )
    IF(IWBP    == NMDI.OR.IWBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR W PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.6.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IW     > NBITS (IWBO   ))   THEN
      IF(IW /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' W PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' W          :'',I10)')   IW
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IWBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IWBO   ),IWBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IW    ,IWBP   )
    ENDIF

!*          7.3.7       X PARAMETER

!*          7.3.7.1     CHECK IF BIT STRUCTURE DEFINED

    IXBP    = NTOXXBP(KOCMAP       )
    IXBO    = NTOXXOC(KOCMAP       )
    IF(IXBP    == NMDI.OR.IXBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR X PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.7.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IX     > NBITS (IXBO   ))   THEN
      IF(IX /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' X PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' X          :'',I10)')   IX
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IXBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IXBO   ),IXBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IX    ,IXBP   )
    ENDIF

!*          7.3.8       Y PARAMETER

!*          7.3.8.1     CHECK IF BIT STRUCTURE DEFINED

    IYBP    = NTOYYBP(KOCMAP       )
    IYBO    = NTOYYOC(KOCMAP       )
    IF(IYBP    == NMDI.OR.IYBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Y PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.8.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IY     > NBITS (IYBO   ))   THEN
      IF(IY /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Y PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Y          :'',I10)')   IY
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IYBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IYBO   ),IYBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IY    ,IYBP   )
    ENDIF

!*          7.3.9       Z PARAMETER

!*          7.3.9.1     CHECK IF BIT STRUCTURE DEFINED

    IZBP    = NTOZZBP(KOCMAP       )
    IZBO    = NTOZZOC(KOCMAP       )
    IF(IZBP    == NMDI.OR.IZBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Z PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.3.9.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IZ     > NBITS (IZBO   ))   THEN
      IF(IZ /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Z PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Z          :'',I10)')   IZ
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IZBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IZBO   ),IZBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IZ    ,IZBP   )
    ENDIF

!*          7.4         HIGH RESOLUTION ATOVS (LEVEL 1C/GEOS)

  ELSEIF(KCDTYP == NGTHRB)     THEN
    IA = 0
    IB = 0
    IC = 0
    IV = 0
    IW = 0
    IX = 0
    IY = 0
    IZ = 0
    CALL TOVSHRIS(KCHAN,KDPT,&
     & IA,IB,IC,IV,IW,IX,IY,IZ       )  

!*          7.4.1       INST. TYPE

!*          7.4.1.1     CHECK IF BIT STRUCTURE DEFINED

    IBPINTP = NCMITBP(KOCMAP,KOTMAP)
    IBOINTP = NCMITOC(KOCMAP,KOTMAP)
    IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR INS. TYPE'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.1.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(KINSTP > NBITS (IBOINTP))   THEN
      IF(KINSTP /= NMDI)              THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
    ENDIF

!*          7.4.2       A PARAMETER

!*          7.4.2.1     CHECK IF BIT STRUCTURE DEFINED

    IABP   = NTOAABP(KOCMAP       )
    IABO   = NTOAAOC(KOCMAP       )
    IF(IABP   == NMDI.OR.IABO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR A PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.2.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IA    > NBITS (IABO  ))   THEN
      IF(IA /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' A PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' A          :'',I10)')   IA
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IABO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IABO   ),IABP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IA    ,IABP   )
    ENDIF

!*          7.4.3       B PARAMETER

!*          7.4.3.1     CHECK IF BIT STRUCTURE DEFINED

    IBBP   = NTOBBBP(KOCMAP       )
    IBBO   = NTOBBOC(KOCMAP       )
    IF(IBBP   == NMDI.OR.IBBO   == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR B PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.3.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IB    > NBITS (IBBO  ))   THEN
      IF(IB /= NMDI)                THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' B PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' B          :'',I10)')   IB
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBBO   ),IBBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IB    ,IBBP   )
    ENDIF

!*          7.4.4       C PARAMETER

!*          7.4.4.1     CHECK IF BIT STRUCTURE DEFINED

    ICBP      = NTOCCBP(KOCMAP       )
    ICBO      = NTOCCOC(KOCMAP       )
    IF(ICBP    == NMDI.OR.ICBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR C PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.4.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IC     > NBITS (ICBO   ))   THEN
      IF(IC /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' IC PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' IC         :'',I10)')   IC
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   ICBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (ICBO   ),ICBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IC    ,ICBP   )
    ENDIF

!*          7.4.5       V PARAMETER

!*          7.4.5.1     CHECK IF BIT STRUCTURE DEFINED

    IVBP    = NTOVVBP(KOCMAP       )
    IVBO    = NTOVVOC(KOCMAP       )
    IF(IVBP    == NMDI.OR.IVBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR V PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.5.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IV     > NBITS (IVBO   ))   THEN
      IF(IV /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' V PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' V          :'',I10)')   IV
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IVBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IVBO   ),IVBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IV    ,IVBP   )
    ENDIF

!*          7.4.6       W PARAMETER

!*          7.4.6.1     CHECK IF BIT STRUCTURE DEFINED

    IWBP    = NTOWWBP(KOCMAP       )
    IWBO    = NTOWWOC(KOCMAP       )
    IF(IWBP    == NMDI.OR.IWBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR W PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.6.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IW     > NBITS (IWBO   ))   THEN
      IF(IW /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' W PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' W          :'',I10)')   IW
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IWBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IWBO   ),IWBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IW    ,IWBP   )
    ENDIF

!*          7.4.7       X PARAMETER

!*          7.4.7.1     CHECK IF BIT STRUCTURE DEFINED

    IXBP    = NTOXXBP(KOCMAP       )
    IXBO    = NTOXXOC(KOCMAP       )
    IF(IXBP    == NMDI.OR.IXBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR X PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.7.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IX     > NBITS (IXBO   ))   THEN
      IF(IX /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' X PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' X          :'',I10)')   IX
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IXBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IXBO   ),IXBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IX    ,IXBP   )
    ENDIF

!*          7.4.8       Y PARAMETER

!*          7.4.8.1     CHECK IF BIT STRUCTURE DEFINED

    IYBP    = NTOYYBP(KOCMAP       )
    IYBO    = NTOYYOC(KOCMAP       )
    IF(IYBP    == NMDI.OR.IYBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Y PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.8.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IY     > NBITS (IYBO   ))   THEN
      IF(IY /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Y PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Y          :'',I10)')   IY
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IYBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IYBO   ),IYBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IY    ,IYBP   )
    ENDIF

!*          7.4.9       Z PARAMETER

!*          7.4.9.1     CHECK IF BIT STRUCTURE DEFINED

    IZBP    = NTOZZBP(KOCMAP       )
    IZBO    = NTOZZOC(KOCMAP       )
    IF(IZBP    == NMDI.OR.IZBO    == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR Z PARAM.'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.4.9.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(IZ     > NBITS (IZBO   ))   THEN
      IF(IZ /= NMDI)                  THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' Z PARAM. LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' Z          :'',I10)')   IZ
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IZBO
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IZBO   ),IZBP   )
    ELSE
      KINSPEC  = INSERT(KINSPEC,IZ    ,IZBP   )
    ENDIF

!*          7.5         SSMI/TRMM

  ELSEIF(KCDTYP == NSSMI )     THEN
    KINSPEC = NMDI

!*          7.6         RETRIEVED OZONE LAYERS

  ELSEIF(KCDTYP == NSTRO3 )     THEN
    
!*          7.6.1       INST. TYPE

!*          7.6.1.1     CHECK IF BIT STRUCTURE DEFINED

    IBPINTP = NCMITBP(KOCMAP,KOTMAP)
    IBOINTP = NCMITOC(KOCMAP,KOTMAP)
    IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
      WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' FOR INS. TYPE'')')
      LLMESAGE = .TRUE.
      LLMESLE1 = .TRUE.
      GO TO 12
    ENDIF

!*          7.6.1.2     CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

    IF(KINSTP > NBITS (IBOINTP))   THEN
      IF(KINSTP /= NMDI)              THEN
        WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
        WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
        WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
        WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
        LLMESAGE = .TRUE.
        LLMESLE2 = .TRUE.
      ENDIF
      KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
    ELSE
      KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
    ENDIF

!*          7.7         MERIS REPORT 
  ELSEIF(KCDTYP == NTCWC )     THEN
    KINSPEC = NMDI

!*          7.8         NOT EXPECTED CODE TYPE

  ELSE
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' NOT EXPECTED SATEM CODE TYPE'')')
    WRITE(NULOUT,'('' CODE TYPE:'',I10)') KCDTYP
    CALL ABOR1('SUBROUTINE OBINSSP')
  ENDIF
!*
!-----------------------------------------------------------------------

!        8.             PAOB INSTRUMENT SPECIFICATIONS
!                       ------------------------------

ELSEIF(KOBTYP == NPAOB )     THEN

!*          8.1         INST. TYPE

!*          8.1.1       CHECK IF BIT STRUCTURE DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          8.1.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KINSTP /= NMDI)              THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF
!*
!-----------------------------------------------------------------------

!        9.             SCAT. INSTRUMENT SPECIFICATIONS
!                       -------------------------------

ELSEIF(KOBTYP == NSCATT)     THEN

!*          9.1         INST. TYPE

!*          9.1.1       CHECK IF BIT STRUCTURE DEFINED

  IBPINTP = NCMITBP(KOCMAP,KOTMAP)
  IBOINTP = NCMITOC(KOCMAP,KOTMAP)
  IF(IBPINTP == NMDI.OR.IBOINTP == NMDI    )        THEN
    WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
    WRITE(NULOUT,'('' FOR INS. TYPE'')')
    LLMESAGE = .TRUE.
    LLMESLE1 = .TRUE.
    GO TO 12
  ENDIF

!*          9.1.2       CHECK IF IT CAN BE STORED; IF IT CAN NOT
!                       SET ALL BITS TO 1

  IF(KINSTP > NBITS (IBOINTP))   THEN
    IF(KINSTP /= NMDI)              THEN
      WRITE(NULOUT,'('' WARNING IN SUBROUTINE OBINSSP'')')
      WRITE(NULOUT,'('' INS. TYPE LONGER THEN NO. OF BITS'','' RESERVED'')')
      WRITE(NULOUT,'('' INS. TYPE  :'',I10)')   KINSTP
      WRITE(NULOUT,'('' NO. OF BITS:'',I10)')   IBOINTP
      LLMESAGE = .TRUE.
      LLMESLE2 = .TRUE.
    ENDIF
    KINSPEC  = INSERT(KINSPEC,NBITS (IBOINTP),IBPINTP)
  ELSE
    KINSPEC  = INSERT(KINSPEC,KINSTP,IBPINTP)
  ENDIF
!*
!-----------------------------------------------------------------------

!        10.             LIMB OBSERVATIONS INSTRUMENT SPECIFICATIONS
!                       ---------------------------------------

ELSEIF(KOBTYP == NLIMB)     THEN
!*
!-----------------------------------------------------------------------

!        11.            UNKNOWN OBS. TYPE
!                       -----------------

ELSE
  WRITE(NULOUT,'(''0ERROR IN SUBROUTINE OBINSSP'')')
  WRITE(NULOUT,'('' OBS. TYPE NOT KNOWN:'',I10)') KOBTYP
  CALL ABOR1('SUBROUTINE OBINSSP')
ENDIF
!*
!-----------------------------------------------------------------------

!        12.            MESSAGES
!                       --------

12 CONTINUE
IF(LLMESAGE)          THEN
  IF(LLMESLE1)          THEN
    WRITE(NULOUT,'('' BIT STRUCTURE NOT DEFINED'')')
    WRITE(NULOUT,'('' OBS. TYPE:'',I10)') KOBTYP
    WRITE(NULOUT,'('' CODE TYPE:'',I10)') KCDTYP
    CALL ABOR1('SUBROUTINE OBINSSP')
  ENDIF
  IF(LLMESLE2)          THEN
    WRITE(NULOUT,'('' ALL BITS SET 1'')')
    WRITE(NULOUT,'('' OBS. TYPE  :'',I10)')   KOBTYP
    WRITE(NULOUT,'('' CODE TYPE  :'',I10)')   KCDTYP
    WRITE(NULOUT,'('' LATITUDE   :'',F10.2)') PLAT
    WRITE(NULOUT,'('' LONGITUDE  :'',F10.2)') PLON
  ENDIF
ENDIF
!*
!-----------------------------------------------------------------------

!        13.            RETURN
!                       ------

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