      SUBROUTINE CMPLBL(NF1,KBUF,NF2,LBUF,OK) 
C
C     * JUL 07/03 - A.IRWIN,F.MAJAESS (REVISED FOR F90 AND LINUX PLATFORMS)
C     * JUL 26/92 - M.LAZARE. REPLACEMENT OF UNFORMATTED READS BY CALLS
C     *                       TO FBUFFIN. 
C     * NOV 29/91 - M.LAZARE. REPLACEMENT OF BUFFER IN BY UNFORMATTED
C     *                       READ.
C     * NOV 14/79 - J.D.HENDERSON 
C     * THE LABEL OF THE NEXT RECORD IN FILE NF1 IS COMPARED TO 
C     * THE LABEL OF THE NEXT RECORD IN FILE NF2. 
C     * IF EITHER FILE NUMBER IS ZERO IT IS ASSUMED THAT
C     * THE CORRESPONDING LABEL IS ALREADY AVAILABLE. 
C     * FIELDS MUST BE OF THE SAME KIND AND SIZE. 
C     * IF NOT, THE VARIABLE OK IS RETURNED AS FALSE. 
C 
      IMPLICIT REAL (A-H,O-Z),
     +INTEGER (I-N)
      LOGICAL OK
      INTEGER KBUF(8),LBUF(8) 
C-------------------------------------------------------------------- 
      OK=.FALSE.
C 
C     * GET THE  FIRST LABEL (IBUF) IF NECESSARY. 
C     * RETURN IF THE  FIRST FILE IS EMPTY. 
C 
      IF(NF1.EQ.0) GO TO 150
C     READ(NF1,END=901) (KBUF(I),I=1,8)
      CALL FBUFFIN(NF1,KBUF,-8,K,LEN)
      IF(K.GE.0) GO TO 901
      BACKSPACE NF1 
C 
C     * GET THE SECOND LABEL (JBUF) IF NECESSARY. 
C     * RETURN IF THE SECOND FILE IS EMPTY. 
C 
  150 IF(NF2.EQ.0) GO TO 210
C     READ(NF2,END=902) (LBUF(I),I=1,8)
      CALL FBUFFIN(NF2,LBUF,-8,K,LEN)
      IF(K.GE.0) GO TO 902
      BACKSPACE NF2 
C 
C     * RETURN IF THE FIELDS ARE OF DIFFERENT KIND OR SIZE. 
C 
  210 IF(KBUF(1).NE.LBUF(1)) RETURN 
      IF(KBUF(5).NE.LBUF(5)) RETURN 
      IF(KBUF(6).NE.LBUF(6)) RETURN 
      IF(KBUF(7).NE.LBUF(7)) RETURN 
C 
      OK=.TRUE. 
      RETURN
  901 WRITE(6,6011)
      RETURN
  902 WRITE(6,6012)
      RETURN
C-------------------------------------------------------------------- 
 6011 FORMAT('  FIRST FILE EMPTY IN CMPLBL') 
 6012 FORMAT(' SECOND FILE EMPTY IN CMPLBL') 
      END 
