      SUBROUTINE ICHREG2(NSPOTS,NLINES,NDATEL,SPOT,LINE,CHNAVL,
     1                  HEIGHT,NIGHT,PRCOMP,RESULT,ERSTAT)
      IMPLICIT NONE
C
C*********************************************************************
C
C   NAME- ICHREG2
C
C   LANGUAGE- VS FORTRAN  TYPE- SUBROUTINE    COMPUTER- CRAY J916
C
C   VERSION- 1.0    DATE- 02/03/93   PROGRAMMER- CARLA NEIGH (SMSRC)
C   VERSION- 2.0    DATE- 07/19/94   PROGRAMMER- FRANK TILLEY (SMSRC)
C       ATOVS-12    EXPLICITLY DECLARED R*4 VARIABLES "TSTLIM" AND
C                   "SUM".
C   VERSION- 2.1    DATE- 09/22/94   PROGRAMMER- ALEX POZDNYAK (SMSRC)
C       XTOVS-52    MSU CHANNEL 2 IS SUBSTITUTED WITH AMSU-A CHANNEL 5.
C                   MSU CHANNEL 3 IS SUBSTITUTED WITH AMSU-A CHANNEL 7.
C                   VARIABLES MSU2P AND MSU3P ARE CHANGED TO AMA5P AND
C                   AMA7P. VALUES EXTRACTED FROM "HIRDAT" FOR MSU
C                   CHANNELS ARE CHANGED TO APPROPRIATE AMSU-A CHANNEL
C                   INDICES.
C   VERSION- 3.0    DATE- 05/29/96   PROGRAMMER- LEAH WILSON (HSTX)
C       SYNTAX MODS FOR ATOVS BASELINE ON CRAY.
C   VERSION- 3.1    DATE- 09/23/97   PROGRAMMER- LEAH WILSON (HSTX)
C       ADD HEIGHT CHECK TO TEST 2 FOR RTOVS UPGRADES. CONVERT ICHRE$
C       TO KIDS CONVENTION.
C   VERSION- 3.2    DATE- 11/25/98   PROGRAMMER- M.P. FERGUSON (RITSS)
C       MODIFY PREDICTORS USED TO CALCULATE AMSU 5 AND AMSU 7 FROM THE
C       LONGWAVE HIRS CHANNELS.
C   VERSION- 3.3    DATE- 02/01/25   PROGRAMMER- F. TILLEY (RITSS)      
C       CALL TO ICHR2$ CORRECTED TO USE 'STATUS' FOR AN ARGUMENT INSTEAD
C       OF 'SATUS'.                                                     
C   VERSION- 1.2    DATE-02/08/02   PORGRAMMER- R. ROLLINS (CSC)
C       PORTED TO IBM SP REDIFINED RCOMP TO L*4
C   VERSION- 1.3    DATE- 02/27/03   PROGRAMMER- Rickey Rollins (CSC)
C        Replace R4SPV equivalence test with ISR4SPV function
C
C   FUNCTION- THIS SUBROUTINE PERFORMS THE IR-MICROWAVE INTERCHANNEL
C             REGRESSION TESTS ON A HIRS SPOT TO DETERMINE IF CLOUDS
C             ARE PRESENT.
C
C   CALLING SEQUENCE PARAMETERS-
C
C     NAME      TYPE  I/O   DESCRIPTION
C     ----      ----  ---   -----------
C     NSPOTS    INT    I    TOTAL NUMBER OF SPOTS IN A HIRS SCAN LINE.
C     NLINES    INT    I    TOTAL NUMBER OF SCAN LINES IN THE HIRS DATA
C                           BUFFER.
C     NDATEL    INT    I    TOTAL NUMBER OF DATA ELEMENTS IN THE HIRS
C                           DATA BUFFER.
C     HIRDAT    REAL   I    3D ARRAY (DIM NSPOTS X NLINES X NDATEL)
C                           CONTAINING THE HIRS DATA BUFFER FOR AN
C                           EXTENDED DATA FRAME.
C     SPOT      INT    I    NUMBER OF HIRS SPOT WITHIN THE SCAN LINE
C                           FOR WHICH THE TESTS ARE BEING PERFORMED.
C     LINE      INT    I    NUMBER OF HIRS SCAN LINE WITHIN THE HIRS
C                           DATA BUFFER WHICH CONTAINS THE SPOT.
C     CHNAVL    INT    I    HIRS CHANNEL AVAILABILITY BIT FLAGS FOR THE
C                           SPOT.
C     HEIGHT    REAL   I    TERRAIN HEIGHT FOR THE HIRS SPOT.
C     NIGHT   LOGICAL  I    LOGICAL FLAG INDICATING WHETHER HIRS SPOT
C                           IS IN NIGHTTIME (TRUE = NIGHT, FALSE = DAY).
C     PRCOMP  LOGICAL  I    LOGICAL ARRAY (DIM 5) CONTAINING THE
C                           PROCESSING FLAGS FOR THE COMPONENTS OF THE
C                           INTERCHANNEL REGRESSION TEST.  VALUE OF
C                           TRUE INDICATES THAT THE TEST COMPONENT
C                           SHOULD BE EXECUTED, FALSE MEANS THAT THE
C                           TEST COMPONENT SHOULD BE SKIPPED.
C     RESULT    INT   I/O   ARRAY (DIM 5) CONTAINING THE RESULTS OF EACH
C                           OF THE COMPONENTS OF THE INTERCHANNEL
C                           REGRESSION TEST.  A VALUE OF 0 MEANS THE
C                           SPOT WAS DETERMINED TO BE CLOUDY FROM THE
C                           TEST COMPONENT, 1 MEANS THE SPOT WAS NOT
C                           DETERMINED TO BE CLOUDY, 2 MEANS THAT A
C                           DETERMINATION COULD NOT BE MADE.  IT IS
C                           ASSUMED THAT ALL ELEMENTS ARE INITIALIZED
C                           TO 2 BEFORE THIS ROUTINE IS CALLED.
C     ERSTAT    INT    O    ERROR RETURN CODE
C                            = 0 IF NO ERROR OCCURRED,
C                            = 10 IF NON-FATAL ERROR OCCURRED,
C                            = 99 IF FATAL ERROR OCCURRED.
C
C   LOCAL PARAMETERS-
C     NAME      TYPE     DESCRIPTION
C     ----      ----     -----------
C     CHAN      INT      DO LOOP COUNTER FOR CHANNEL.
C     I         INT      DO LOOP COUNTER.
C     HIR7P     REAL     PREDICTED HIRS CHANNEL 7 VALUE.
C     AMA5P     REAL     PREDICTED AMSU-A CHANNEL 5 VALUE.
C     AMA7P     REAL     PREDICTED AMSU-A CHANNEL 7 VALUE.
C     STATUS    INT      STATUS CODE RETURNED FROM ICHRE$.
C     SUM       REAL     VARIABLE USED TO HOLD INTERMEDIATE
C                        VALUES DURING CALCULATION OF THE
C                        PREDICTED AMSU-A CHANNEL 5 VALUE.
C     TSTLIM    REAL     HIGH OR LOW TERRAIN HEIGHT LIMIT.
C
C
C   SUBPROGRAMS CALLED- PRDCHN, ICHRE$
C
C   FUNCTIONS USED- ABS, BTEST
C
C   EXIT STATES-
C     ERSTAT = 10 - A COMPONENT OF THE INTERCHANNEL REGRESSION TEST
C                   COULD NOT BE EXECUTED.
C     ERSTAT = 99 - A FATAL ERROR WAS RETURNED FROM ICHRE$.
C
C   COMMENTS-
C
C    IT IS ASSUMED THAT THE ELEMENTS OF THE RESULT ARRAY HAVE BEEN
C    INITIALIZED TO 2 BEFORE THIS ROUTINE IS CALLED.
C
C    THE REFERENCE FOR THIS CLOUD TEST IS:
C     COX, KARL W., 1987: "THE NOAA-K,L & M SOUNDING ALGORITHMS
C     SCIENTIFIC BASIS., S M SYSTEMS AND RESEARCH CORPORATION,
C     IIA-7 - IIA-20.
C
C**********************************************************************
C
      INTEGER NSPOTS, NLINES, NDATEL, SPOT, LINE, ERSTAT
      INTEGER CHNAVL, RESULT(5)
      REAL  HEIGHT
C     LOGICAL NIGHT, PRCOMP(5)
      LOGICAL NIGHT
      LOGICAL*4 PRCOMP(5)
      LOGICAL ISR4SPV
C
      INTEGER STATUS, CHAN, I
      REAL HIR7P, AMA5P, AMA7P, SUM, TSTLIM
C
      INCLUDE 'REGCOE'
      INCLUDE 'SPVAL'
      INCLUDE 'INSPARM'
      INCLUDE 'INSCOM'
C
      ERSTAT = 0
C
C   THERE ARE FIVE COMPONENTS OF THE INTERCHANNEL REGRESSION TEST.
C   THE FIRST 3 COMPONENTS ARE EXECUTED ONLY FOR SPOTS IN NIGHTTIME.
C
      PSHIR7(SPOT,LINE) = R4SPV
      IF (NIGHT) THEN
C
C   CHECK TO SEE IF COMPONENT 1 IS TO BE EXECUTED.
C
         IF (PRCOMP(1)) THEN
C
C         THIS COMPONENT OF THE TEST CHECKS THE PREDICTED VALUE
C         OF HIRS CHANNEL 7 COMPUTED USING HIRS CHANNELS 13 - 17.
C         CALL THE ROUTINE PRDCHN TO COMPUTE THE PREDICTED HIRS CHANNEL
C         7 VALUE.  PRDCHN RETURNS A STATUS CODE OF 1 IF A REGRESSION
C         COEFFICIENT VALUE FOR THE SPOT IS MISSING.
C
            CALL PRDCHN(NSPOTS,NLINES,NDATEL,HIRDAT,SPOT,LINE,13,17,
     1                  CHNAVL,COEFA,HIR7P,STATUS)
            PSHIR7(SPOT,LINE) = HIR7P
C
C         IF THE REGRESSION COEFFICIENTS OR THE TEST LIMIT FOR THE SPOT
C         CONTAIN A MISSING VALUE, WRITE A WARNING MESSAGE TO THE
C         KIDS MESSAGE LOG FILE AND SKIP THIS COMPONENT OF THE
C         TEST.
C
            IF ((ISR4SPV(TSTLMA(SPOT))) .OR. (STATUS .EQ. 1)) THEN
               CALL ICHR2$(101,STATUS)
               ERSTAT = 10
               IF (STATUS.EQ.99) THEN
                  ERSTAT = 99
                  RETURN
               ENDIF
            ELSE
C
C            IF THE DIFFERENCE BETWEEN THE PREDICTED VALUE AND THE
C            ACTUAL VALUE OF HIRS CHANNEL 7 IS NOT WITHIN THE LIMIT
C            FOR THE SPOT, THE SPOT IS MARKED CLOUDY.
C
               IF ((.NOT. ISR4SPV(HIR7P)) .AND.
     1           (.NOT. ISR4SPV(HIRDAT(SPOT,LINE,7)))) THEN
                  IF(ABS(HIR7P-HIRDAT(SPOT,LINE,7)).GT.TSTLMA(SPOT))THEN
                    RESULT(1) = 0
                  ELSE
                    RESULT(1) = 1
                  ENDIF
               ENDIF
             ENDIF
         ENDIF
C
C   CHECK TO SEE IF COMPONENT 2 IS TO BE EXECUTED. (DON'T DO IF HEIGHT IS
C   ABOVE 500 METERS)
C
         IF (PRCOMP(2).AND.HEIGHT.LT.500.0) THEN
C
C        THIS COMPONENT OF THE TEST CHECKS THE PREDICTED VALUE
C        OF AMSU-A CHANNEL 5 COMPUTED USING HIRS CHANNELS 13 - 17.
C        CALL THE ROUTINE PRDCHN TO COMPUTE THE PREDICTED AMSU-A CHANNEL
C        5 VALUE.  PRDCHN RETURNS A STATUS CODE OF 1 IF A REGRESSION
C        COEFFICIENT VALUE FOR THE SPOT IS MISSING.
C
           CALL PRDCHN(NSPOTS,NLINES,NDATEL,HIRDAT,SPOT,LINE,13,17,
     1                 CHNAVL,COEFC,AMA5P,STATUS)
C
C         IF THE REGRESSION COEFFICIENTS OR THE TEST LIMIT FOR THE SPOT
C         CONTAIN A MISSING VALUE, WRITE A WARNING MESSAGE TO THE
C         KIDS MESSAGE LOG FILE AND SKIP THIS COMPONENT OF THE
C         TEST.
C
           IF ((ISR4SPV(TSTLMC(SPOT))).OR.(STATUS.EQ.1)) THEN
             PSMSU2(SPOT,LINE) = R4SPV
             CALL ICHR2$(102,STATUS)
             ERSTAT = 10
             IF (STATUS.EQ.99) THEN
                ERSTAT = 99
                RETURN
             ENDIF
           ELSE
C
C            IF THE DIFFERENCE BETWEEN THE PREDICTED VALUE AND THE
C            ACTUAL VALUE OF AMSU-A CHANNEL 5 IS NOT WITHIN THE LIMIT
C            FOR THE SPOT, THE SPOT IS MARKED CLOUDY.
C
             IF ((.NOT. ISR4SPV(AMA5P)) .AND.
     1          (.NOT. ISR4SPV(HIRDAT(SPOT,LINE,25)))) THEN
                PSMSU2(SPOT,LINE) = AMA5P 
               IF(ABS(AMA5P-HIRDAT(SPOT,LINE,25)).GT.TSTLMC(SPOT))THEN
                  RESULT(2) = 0
               ELSE
                  RESULT(2) = 1
               ENDIF
             ELSE
                PSMSU2(SPOT,LINE) = R4SPV
             ENDIF
           ENDIF
         ELSE
            PSMSU2(SPOT,LINE) = R4SPV
         ENDIF
C
C   CHECK TO SEE IF COMPONENT 3 IS TO BE EXECUTED.
C
         IF (PRCOMP(3)) THEN
C
C        THIS COMPONENT OF THE TEST CHECKS THE PREDICTED VALUE
C        OF AMSU-A CHANNEL 7 COMPUTED USING HIRS CHANNELS 13 - 17.
C        CALL THE ROUTINE PRDCHN TO COMPUTE THE PREDICTED AMSU-A CHANNEL
C        7 VALUE.  PRDCHN RETURNS A STATUS CODE OF 1 IF A REGRESSION
C        COEFFICIENT VALUE FOR THE SPOT IS MISSING.
C
            CALL PRDCHN(NSPOTS,NLINES,NDATEL,HIRDAT,SPOT,LINE,13,17,
     1                  CHNAVL,COEFE,AMA7P,STATUS)
C
C         IF THE REGRESSION COEFFICIENTS OR THE TEST LIMIT FOR THE SPOT
C         CONTAIN A MISSING VALUE, WRITE A WARNING MESSAGE TO THE
C         KIDS MESSAGE LOG FILE AND SKIP THIS COMPONENT OF THE
C         TEST.
C
            IF ((ISR4SPV(TSTLME(SPOT))).OR.(STATUS.EQ.1)) THEN
               PSMSU3(SPOT,LINE) = R4SPV
               CALL ICHR2$(103,STATUS)
               ERSTAT = 10
               IF (STATUS.EQ.99) THEN
                  ERSTAT = 99
                  RETURN
               ENDIF
            ELSE
C
C            IF THE DIFFERENCE BETWEEN THE PREDICTED VALUE AND THE
C            ACTUAL VALUE OF AMSU-A CHANNEL 7 IS NOT WITHIN THE LIMIT
C            FOR THE SPOT, THE SPOT IS MARKED CLOUDY.
C
               IF ((.NOT. ISR4SPV(AMA7P)) .AND.
     1            (.NOT. ISR4SPV(HIRDAT(SPOT,LINE,27)))) THEN
                 PSMSU3(SPOT,LINE) = AMA7P
                 IF(ABS(AMA7P-HIRDAT(SPOT,LINE,27)).GT.TSTLME(SPOT))THEN
                    RESULT(3) = 0
                 ELSE
                    RESULT(3) = 1
                 ENDIF
               ELSE
                  PSMSU3(SPOT,LINE) = R4SPV
               ENDIF
            ENDIF
         ENDIF
C
      ENDIF
C
C   THE REMAINING TEST COMPONENTS ARE EXECUTED IN DAYTIME OR NIGHTTIME.
C
C
C   CHECK TO SEE IF COMPONENT 4 IS TO BE EXECUTED.
C
      IF (PRCOMP(4)) THEN
C
C      THIS COMPONENT OF THE TEST CHECKS THE PREDICTED VALUE
C      OF AMSU-A CHANNEL 5 COMPUTED USING HIRS CHANNELS 3 - 6.
C      THE PREDICTED CHANNEL COMPUTATION DIFFERS FOR SPOTS WITH A
C      TERRAIN HEIGHT UNDER 500 METERS AND SPOTS WITH A TERRAIN
C      HEIGHT EQUAL TO OR OVER 500 METERS.
C
         IF (HEIGHT .LT. 500.0) THEN
C
C         SET THE TEST LIMIT TO THE LIMIT FOR LOW TERRAIN HEIGHTS.
C
            TSTLIM = TSTLMF(SPOT)
C
C      CALL THE ROUTINE PRDCHN TO COMPUTE THE PREDICTED AMSU-A CHANNEL
C      5 VALUE.  PRDCHN RETURNS A STATUS CODE OF 1 IF A REGRESSION
C      COEFFICIENT VALUE FOR THE SPOT IS MISSING.
C
            CALL PRDCHN(NSPOTS,NLINES,NDATEL,HIRDAT,SPOT,LINE,3,6,
     1                 CHNAVL,COEFF,AMA5P,STATUS)
C
         ELSE
            AMA5P = R4SPV
            PLMSU2(SPOT,LINE) = AMA5P
            GO TO 21
         ENDIF
C
C        IF THE REGRESSION COEFFICIENTS OR THE TEST LIMIT OR THE SPOT
C        CONTAIN A MISSING VALUE, WRITE A WARNING MESSAGE TO THE
C        MAINTENANCE MESSAGE LOG FILE AND SKIP THIS COMPONENT OF THE
C        TEST.
C
    30   IF ((ISR4SPV(TSTLIM)) .OR. (STATUS.EQ.1)) THEN
            PLMSU2(SPOT,LINE) = R4SPV
            CALL ICHR2$(104,STATUS)
            ERSTAT = 10
            IF (STATUS.EQ.99) THEN
               ERSTAT = 99
               RETURN
            ENDIF
         ELSE
C
C        IF THE DIFFERENCE BETWEEN THE PREDICTED VALUE AND THE ACTUAL 
C        VALUE OF AMSU CHANNEL 5 IS NOT WITHIN THE LIMIT FOR THE SPOT,
C        THE SPOT IS MARKED CLOUDY.
C
            IF ((.NOT. ISR4SPV(AMA5P)) .AND.
     1          (.NOT. ISR4SPV(HIRDAT(SPOT,LINE,25)))) THEN
                PLMSU2(SPOT,LINE) = AMA5P
               IF (ABS(AMA5P-HIRDAT(SPOT,LINE,25)).GT.TSTLIM)THEN
                  RESULT(4) = 0
               ELSE
                  RESULT(4) = 1
               ENDIF
            ENDIF
         ENDIF
      ENDIF
 21   CONTINUE
C
C   CHECK TO SEE IF COMPONENT 5 IS TO BE EXECUTED.
C
      IF (PRCOMP(5)) THEN
C
C      THIS COMPONENT OF THE TEST CHECKS THE PREDICTED VALUE
C      OF AMSU-A CHANNEL 7 COMPUTED USING HIRS CHANNELS 3 - 5.
C      CALL THE ROUTINE PRDCHN TO COMPUTE THE PREDICTED AMSU-A CHANNEL
C      7 VALUE.  PRDCHN RETURNS A STATUS CODE OF 1 IF A REGRESSION
C      COEFFICIENT VALUE FOR THE SPOT IS MISSING.
C
         CALL PRDCHN(NSPOTS,NLINES,NDATEL,HIRDAT,SPOT,LINE,3,5,
     1              CHNAVL,COEFJ,AMA7P,STATUS)
C
C      IF THE REGRESSION COEFFICIENTS OR THE TEST LIMIT FOR THE SPOT
C      CONTAIN A MISSING VALUE, WRITE A WARNING MESSAGE TO THE
C      KIDS MESSAGE LOG FILE AND SKIP THIS COMPONENT OF THE
C      TEST.
C
         IF (ISR4SPV(TSTLMJ(SPOT))) THEN
            PLMSU3(SPOT,LINE) = R4SPV
            CALL ICHR2$(105,STATUS)
            ERSTAT = 10
            IF (STATUS.EQ.99) THEN
               ERSTAT = 99
               RETURN
            ENDIF
         ELSE
C
C         IF THE DIFFERENCE BETWEEN THE PREDICTED VALUE AND THE
C         ACTUAL VALUE OF AMSU-A CHANNEL 7 IS NOT WITHIN THE LIMIT
C         FOR THE SPOT, THE SPOT IS MARKED CLOUDY.
C
          IF ((.NOT. ISR4SPV(AMA7P)) .AND.
     1       (.NOT. ISR4SPV(HIRDAT(SPOT,LINE,27)))) THEN
             PLMSU3(SPOT,LINE) = AMA7P
             IF (ABS(AMA7P-HIRDAT(SPOT,LINE,27)).GT.TSTLMJ(SPOT)) THEN
                  RESULT(5) = 0
               ELSE
                  RESULT(5) = 1
               ENDIF
            ELSE
               PLMSU3(SPOT,LINE) = R4SPV
            ENDIF
         ENDIF
      ENDIF
C
      RETURN
      END
C
C**********************************************************************
      SUBROUTINE ICHR2$(MSGCOD,STAT)
C
C**********************************************************************
C
C   NAME- ICHR2$
C
C   LANGUAGE- VS FORTRAN  TYPE- SUBROUTINE      COMPUTER- CRAY J916
C
C   VERSION- 1.0    DATE-   2/1/93    PROGRAMMER- CARLA NEIGH (SMSRC)
C   VERSION- 2.0    DATE- 09/22/94    PROGRAMMER- ALEX POZDNYAK (SMSRC)
C       XTOVS-52    MSU CHANNEL 2 IS SUBSTITUTED WITH AMSU-A CHANNEL 5.
C                   MSU CHANNEL 3 IS SUBSTITUTED WITH AMSU-A CHANNEL 7.
C   VERSION- 3.0    DATE- 9/22/97    PROGRAMMER- LEAH WILSON (HSTX)
C
C   FUNCTION- THIS SUBROUTINE WRITES OUT ERROR MESSAGES TO THE
C             KIDS MESSAGE LOG FILE FOR THE SUBROUTINE ICHREG2.
C   VERSION- 3.0 CONVERSION FROM MMLF TO KIDS FILE.
C
C   FILES-
C     DSN OR DESCRIPTIVE TITLE I/O   UNIT  FUNCTIONAL DESCRIPTION
C     ------------------------ ---   ----  ----------------------
C     ...KIDS                   O   KUNIT  KRAY INTERACTIVE DOCUMENTATION
C                                          SYSTEM.
C
C   CALLING SEQUENCE PARAMETERS-
C     VARIABLE          TYPE I/O  FUNCTION
C     --------          ---- ---  --------
C     MSGCOD             INT  I   MESSAGE CODE OF ERROR DETECTED.
C     STAT               INT  O   ERROR STATUS CODE
C                                  = 0 IF NO ERROR OCCURRED,
C                                 <> 0 IF ERROR OCCURRED.
C
C   COMMON AREA PARAMETERS-
      INCLUDE 'SPGUNT'
      INCLUDE 'ERPARM'
      INCLUDE 'ERINFO'
C
C   LOCAL PARAMETERS-
C     VARIABLE          TYPE  FUNCTION
C     --------          ----  --------
C     NAME              CH*6  MAIN ROUTINE NAME.
C     C4TEMP            CH*4  DUMMY FOR WRITING TO KIDS FILE.
C     I                  INT  DO LOOP CONTROL INDEX.
C     COUNT              INT  COUNTER FOR NUMBER OF TIMES $-ROUTINE
C                             HAS BEEN INVOKED.
C     KMSG             CH*100 KIDS MESSAGE BUFFER
C
C   SUBPROGRAMS CALLED-  KIDS 
C
C***********************************************************************
C
      CHARACTER*4 C4TEMP
      CHARACTER*6 NAME
      CHARACTER*100 KMSG
      INTEGER   STAT, I, MSGCOD, COUNT(5)
      DATA COUNT /0,0,0,0,0/
      SAVE COUNT
C
C
C   SET THE MAIN NAME.
C
      SUBNAM = 'SPGDVR'
      STAT = 0
C
C     CHECK FOR VALID MESSAGE CODES.
C
      IF (MSGCOD .EQ. 101) THEN
        COUNT(1) = COUNT(1) + 1
        IF (COUNT(1).GT.1) RETURN
      KMSG(1:51)='* WARNING * I/C Regr. test for est. of HIRS-7 from'
      KMSG(52:100)='HIRS 13-17 has missing test limit and is not done'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSEIF (MSGCOD .EQ. 102) THEN
        COUNT(2) = COUNT(2) + 1
        IF (COUNT(2).GT.1) RETURN
      KMSG(1:51)='* WARNING * I/C Regr. test for est. of AMSU-A ch.5'
      KMSG(52:100)='from H13-17 has missing test limit & is not done'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSEIF (MSGCOD .EQ. 103) THEN
        COUNT(3) = COUNT(3) + 1
        IF (COUNT(3).GT.1) RETURN
      KMSG(1:51)='* WARNING * I/C Regr. test for est. of AMSU-A ch.7'
      KMSG(52:100)='from H13-17 has missing test limit & is not done'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSEIF (MSGCOD .EQ. 104) THEN
        COUNT(4) = COUNT(4) + 1
        IF (COUNT(4).GT.1) RETURN
      KMSG(1:51)='* WARNING * I/C Regr. test for est. of AMSU-A ch.5'
      KMSG(52:100)='from H1-12 has missing test limit & is not done'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSEIF (MSGCOD .EQ. 105) THEN
        COUNT(5) = COUNT(5) + 1
        IF (COUNT(5).GT.1) RETURN
      KMSG(1:51)='* WARNING * I/C Regr. test for est. of AMSU-A ch.7'
      KMSG(52:100)='from H1-12 has missing test limit & is not done'
        CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
C
      ELSE
C
C NOT A VALID MSGCOD
C
         STAT=0
         KMSG = ' Invalid error message code = '
         WRITE(C4TEMP,'(I4)') MSGCOD
         KMSG(31:34) = C4TEMP
         CALL KIDS(KUNIT,SUBNAM,0,KMSG,0)
      ENDIF
      RETURN
      END

