      SUBROUTINE CMAADJ(DMLNMP,BUFLEN,OVLEN,MXGDLN)
      IMPLICIT NONE
C***********************************************************************
C
C   NAME- CMAADJ
C
C   LANGUAGE- FORTRAN 77     TYPE- SUBROUTINE    COMPUTER- CRAY    
C
C   VERSION- 1.0        DATE- 6/3/91   PROGRAMMER- CARLA NEIGH (SMSRC)
C   VERSION- 2.0        DATE- 6/9/96   PROGRAMMER- ALEX POZDNYAK (FDC)
C      FOR REHOSTING TO THE CRAY, CHANGED ALL I*4 DECLARATIONS TO
C      INTEGER AND ALL LOG*1 DECLARATIONS TO LOGICAL.
C   VERSION- 2.1        DATE- 12/31/01 PROGRAMMER- FRANK TILLEY(RAYTHEON)
C      CLONED FROM CMXADJ AND MODIFIED TO MAP TO AMSU-A SCAN BUFFER.
C      (PR #55)
C
C   FUNCTION- THIS SUBROUTINE COMPUTES THE MAXIMUM NUMBER OF ADJACENT
C             USABLE (I.E. NOT FILLED WITH MISSING VALUES) SCAN LINES
C             OVER AN AMSU-A 256 SECOND DATA FRAME.
C
C   CALLING SEQUENCE PARAMETERS-
C   NAME      TYPE   I/O   DESCRIPTION
C   ----      ----   ---   -----------
C   DMLNMP    LOG     I    INSTRUMENT DUMMY LINE MAP-
C                          ARRAY OF LENGTH BUFLEN WHERE ELEMENT IS
C                          SET TO TRUE IF SCAN LINE CONTAINS USABLE
C                          DATA, SET TO FALSE IF DATA IS NOT USABLE
C   BUFLEN    INT     I    NUMBER OF SCAN LINES IN EXTENDED DATA FRAME
C                          BUFFER FOR INSTRUMENT
C   OVLEN     INT     I    LENGTH OF DATA FRAME OVERLAP FOR INSTRUMENT
C   MXGDLN    INT     O    MAXIMUM NUMBER OF ADJACENT USABLE LINES
C                          IN 256 SECOND DATA FRAME
C
C   LOCAL VARIABLES
C   NAME     TYPE    DESCRIPTION
C   ----     ----    -----------
C   STRPNT   INT     STARTING LINE OF 256 SECOND DATA FRAME IN EXTENDED
C                    DATA FRAME BUFFER
C   ENDPNT   INT     ENDING LINE OF 256 SECOND DATA FRAME IN EXTENDED
C                    DATA FRAME BUFFER
C   INDX     INT     DO LOOP INDEX
C   GDLNCT   INT     COUNTER FOR NUMBER OF USABLE LINES
C
C   EXIT STATES:  NONE
C
C***********************************************************************
      INTEGER   BUFLEN, OVLEN, STRPNT, ENDPNT, INDX, MXGDLN, GDLNCT
      LOGICAL*1 DMLNMP(BUFLEN)
C
C   INITIALIZE VARIABLES
C
      MXGDLN = 0
      GDLNCT = 0
C
C   SET THE STARTING AND ENDING POINTS OF 256 SECOND FRAME IN
C   EXTENDED AMSU-A DATA FRAME
C
      STRPNT = 8
      ENDPNT = 39
C
C   COMPUTE MAXIMUM NUMBER OF USABLE LINES OVER 256 SECOND DATA FRAME
C
      DO 10 INDX = STRPNT, ENDPNT
        IF (DMLNMP(INDX)) THEN
           GDLNCT = GDLNCT + 1
           IF (GDLNCT.GT.MXGDLN) MXGDLN = GDLNCT
        ELSE
           GDLNCT = 0
        ENDIF
   10 CONTINUE
C
      RETURN
      END
