      SUBROUTINE RCDBV(CHNCMB, CLDCHN, RETMET, CNFLIM, CLRHGT, LIMHGT, 
     +                 LIMHG2,SIMCHN,NRTHLM,STHLIM,CDBST)
      IMPLICIT NONE
C
C***********************************************************************
C
C   NAME- RCDBV
C
C   LANGUAGE- FORTRAN 77      TYPE- SUBROUTINE      COMPUTER- CRAY    
C
C   VERSION- 1.0      DATE- 2/19/92      PROGRAMMER-  DAVE MOREL (SMSRC)
C   VERSION- 2.0    DATE- 11/26/94  PROGRAMMER- ALEX POZDNYAK, (SMSRC).
C      XATOV-78: VALUES FOR HIRS, MSU AND SSU ASSOCIATED CHANNEL
C                INFORMATION REMOVED. 3D CONSISTENCY CHECK VALUES
C                 REMOVED. LABEL 999 CHANGED TO 900.
C   VERSION- 3.0      DATE- 5/10/96  PROGRAMMER- ALEX POZDNYAK, (FDC)   
C      MODIFIED TO RUN ON THE CRAY.  REPLACED I*4 WITH INT AND
C      R*4 WITH REAL.
C   VERSION- 3.1      DATE- 7/25/97  PROGRAMMER- LEAH WILSON (HSTX)     
C      REPLACED CDB UTILITIES WITH NEW 8-BYTE CDB UTILITIES.
C   VERSION- 3.2      DATE- 10/01/98 PROGRAMMER- M.P.FERGUSON (RITTS)
C      INCLUDED CODE TO READ HITERRAIN CHANNEL COMBINATION OFF OF CDB,
C      AND INCREASED ARRAY SIZE OF CHNCMB FROM 2X3 TO 2X4 TO ACCOMODATE
C      THIS NEW VALUE.
C   VERSION- 3.3      DATE- 01/27/99 PROGRAMMER- M.P.FERGUSON (RITTS)
C      VARIABLE LIMHGT RETRIEVED FROM CDB.
C   VERSION- 3.4      DATE- 02/14/00 PROGRAMMER- M.P.FERGUSON (RITSS)
C      VARIABLE CHNCMB EXPANDED TO 2X4X2 ARRAY TO ALLOW USE OF LAND AND
C      SEA CHANNEL COMBINATIONS.  CALLS TO INTCOEFF ADDED TO OBTAIN THESE
C      CHANNEL COMBINATIONS.
C   VERSION- 3.5      DATE- 05/03/00 PROGRAMMER- M.P.FERGUSON (RITSS)
C      HIGH TERRAIN CHANNEL COMBINATION FOR AREAS IN EXCESS OF LIMHG2 M IN
C      HEIGHT IS OBTAINED FROM THE CDB.
C   VERSION- 3.6      DATE- 06/05/00 PROGRAMMER- M.P.FERGUSON (RITSS)
C      HIGH TERRAIN LEVEL 2 ABOVE WHICH HIGH TERRAIN 2 CHANNEL COMBINATION
C      WILL BE USED, LIMHG2.
C   VERSION- 3.7      DATE- 07/07/00 PROGRAMMER- M.P.FERGUSON (RITSS)
C      GET THE NORTH AND SOUTH LATITUDE CLEAR RETRIEVAL LIMITS. (WR#88)
C   VERSION- 3.8      DATE- 07/21/00 PROGRAMMER- M.P.FERGUSON (RITSS)
C      GET THE CLEAR RETRIEVAL HEIGHT DELIMITER, CLRHGT. (WR#88)
C   VERSION- 3.9      DATE- 10/18/01 PROGRAMMER- FRANK TILLEY (RAYTHEON)
C      MOVED CALL TO INTCOEF FOR SIMCHN TO THE TOP OF THE CALL LIST     
C      TO KEEP IT FROM INTERFERING WITH VALUES FOR NRTHLM AND STHLIM.   
C      (PR # 48)                                                        
C   FUNCTION- THIS SUBROUTINE GETS THE CDB VALUES USED FOR THE
C             CHANNEL COMBINATION, CLOUD AFFECTED CHANNELS AND
C             RETRIEVAL METHOD USED PER PATH.
C
C   FILES-
C     DSN OR DESCRIPTIVE TITLE  I/O  UNIT    FUNCTIONAL DECRIPTION
C     ------------------------  ---  ----    ---------------------
C     NSS. ... . ... .CDB        I   CDBUNT  COEFFICIENT DATA BASE
C
C   CALLING SEQUENCE PARAMETERS-
C
C   NAME    TYPE  I/O    DESCRIPTION
C   ----    ----  ---    -----------
C   CHNCMB  INT    O     ARRAY OF DIMENSION (2,4,2) WHERE THE FIRST INDEX
C                        IS FOR INSTRUMENT TYPE (1 = HIRS, 2 = AMSU) AND
C                        THE SECOND IS FOR RETRIEVAL TYPE (CLEAR, CLOUDY,
C                        NOHIRS, HIGH TERRAIN), WHILE THE THIRD INDEX IS
C                        FOR TERRAIN TYPE (1 = SEA, 2 = LAND).
C   CLDCHN  INT    O     VECTOR OF LENGTH 2 WHICH CONTAINS THE
C                        CHANNELS AFFECTED BY CLOUDS BIT FLAGS.
C   LIMHGT  REAL   O     MAXIMUM HEIGHT FOR WHICH A CLEAR RETRIEVAL WILL
C                        MADE.
C   RETMET  INT    O     VECTOR OF LENGTH 3 WHICH CONTAINS THE
C   CNFLIM  INT    O     THE SPOT CONFIDENCE MINIMUM LIMIT.
C   CDBST   REAL   O     STATUS CODE RETURNED FROM ROUTINE
C                        INDICATING ERRORS IN OBTAINING
C                        CDB VALUES.
C                        = 0 IF NO ERROR ENCOUNTERED, > 0 IF
C                        ERROR ENCOUNTERED IN ACCESSING THE CDB.
C
C   LOCAL VARIABLES-     NONE
C
C   SUBPROGRAMS CALLED-  INTCOEF
C
C   EXIT STATES-
C     CDBST > 0   : ERROR ENCOUNTERED IN ACCESSING CDB VALUES
C     THE ERROR CODE RETURNED IS THE ERROR CODE FROM THE CDB ACCESS
C     UTILITY.
C
C   COMMENTS- THIS SUBROUTINE ASSUMES THAT THE OPERATION OPENCDB IS
C             DONE ELSEWHERE IN PROCESSING.
C
C***********************************************************************
C
      INCLUDE 'SPGUNT'
      INTEGER CHNCMB(2,4,2), CLDCHN(2), RETMET(3), CNFLIM, CDBST
      INTEGER SIMCHN(35)
      REAL CLRHGT,LIMHGT,LIMHG2,STHLIM,NRTHLM
C
C   INITIALIZE CDB STATUS.
C
      CDBST = 0
C
C  GET THE SIMULATED RADIANCE USE FOR FIRST GUESS FLAG.           
C
      CALL INTCOEF(CDBUNT,'FGUESS  ','SELECT  ','SIMULATD',35,0,0,
     1            0,SIMCHN,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
C
C   GET CHANNEL COMBINATION FLAGS FOR ALL THREE PATHS.
C
      CALL INTCOEF(CDBUNT,'RETRIEVE','CLR     ','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,1,1),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','CLDY    ','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,2,1),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','NOHIR   ','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,3,1),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','CLRLAND ','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,1,2),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','CLDYLAND','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,2,2),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','NOHIRLND','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,3,2),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','HITERAIN','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,4,2),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL INTCOEF(CDBUNT,'RETRIEVE','HITERAI2','CHANCOMB',2,0,0,0,
     1             CHNCMB(1,4,1),'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900

      CALL REALCOEF(CDBUNT,'RETRIEVE','HITERAIN','CLRHGT  ',1,0,0,0,
     1             CLRHGT,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL REALCOEF(CDBUNT,'RETRIEVE','HITERAIN','LIMHGT  ',1,0,0,0,
     1             LIMHGT,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900

      CALL REALCOEF(CDBUNT,'RETRIEVE','HITERAI2','LIMHGT2 ',1,0,0,0,
     1             LIMHG2,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      CALL REALCOEF(CDBUNT,'RETRIEVE','CLRLATLM','NORTHLIM',1,0,0,0,
     1             NRTHLM,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900

      CALL REALCOEF(CDBUNT,'RETRIEVE','CLRLATLM','SOUTHLIM',1,0,0,0,
     1             STHLIM,'GET',CDBST)
C
C   GET CHANNELS AFFECTED BY CLOUDS BIT FLAGS.
C
      CALL INTCOEF(CDBUNT,'RETRIEVE','CHANNELS','CLDAFTCD',2,0,0,0,
     1             CLDCHN,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
C
C   GET RETRIEVAL METHODS FOR ALL THREE PATHS.
C
      CALL INTCOEF(CDBUNT,'RETRIEVE','METHOD  ','PATHS   ',3,0,0,0,
     1             RETMET,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
C
C  GET THE SPOT CONFIDENCE LIMIT.
C
      CALL INTCOEF(CDBUNT,'INSTRMNT','MINIMUM ','SPOTCONF',1,0,0,
     1             0,CNFLIM,'GET',CDBST)
      IF(CDBST.NE.0) GO TO 900
      RETURN
C
 900  CDBST=99 
      RETURN
      END
