      SUBROUTINE BSUBT(M,N,A,KA,ML,MU,B,KB,NL,NU,C,KC,L,MCL,MCU,IERR)
C     ******************************************************************
C     SUBTRACTION OF REAL BANDED MATRICES
C     ******************************************************************
      REAL A(KA,1), B(KB,1), C(KC,L)
C
C     SUBTRACTION OF THE DIAGONALS BELOW THE MAIN DIAGONALS
C     AND SUBTRACTION OF THE MAIN DIAGONALS
C
      IERR = 0
      IF (NL-ML) 10,30,20
C
   10 IF (ML .GE. L) GO TO 200
      MCL = ML
      JA = ML - NL
      JB = 0
      JC = JA
      JMAX = NL + 1
      DO 12 J = 1,JC
        DO 11 I = 1,M
   11   C(I,J) = A(I,J)
   12 CONTINUE
      GO TO 60
C
   20 IF (NL .GE. L) GO TO 210
      MCL = NL
      JA = 0
      JB = NL - ML
      JC = JB
      JMAX = ML + 1
      DO 22 J = 1,JC
        DO 21 I = 1,M
   21   C(I,J) = -B(I,J)
   22 CONTINUE
      GO TO 60
C
   30 MCL = ML
      IF (ML .EQ. 0) GO TO 40
      IMIN = ML + 1
      DO 32 J = 1,ML
        DO 31 I = IMIN,M
        IF (A(I,J)-B(I,J)) 50,31,50
   31   CONTINUE
      MCL = MCL - 1
   32 IMIN = IMIN - 1
C
   40 JA = ML
      JB = ML
      JC = 0
      JMAX = 1
      GO TO 60
C
   50 JA = J - 1
      JB = JA
      JC = 0
      JMAX = ML + 1 - JA
      IF (JMAX .GT. L) GO TO 220
C
   60 DO 62 J = 1,JMAX
      JA = JA + 1
      JB = JB + 1
      JC = JC + 1
        DO 61 I = 1,M
   61   C(I,JC) = A(I,JA) - B(I,JB)
   62 CONTINUE
C
C     SUBTRACTION OF THE DIAGONALS ABOVE THE MAIN DIAGONALS
C
      IF (NU-MU) 100,140,120
C
  100 IF (JC+MU .GT. L) GO TO 230
      MCU = MU
      IF (NU .EQ. 0) GO TO 110
      DO 102 J = 1,NU
      JA = JA + 1
      JB = JB + 1
      JC = JC + 1
        DO 101 I = 1,M
  101   C(I,JC) = A(I,JA) - B(I,JB)
  102 CONTINUE
C
  110 JMAX = MU - NU
      DO 112 J = 1,JMAX
      JA = JA + 1
      JC = JC + 1
        DO 111 I = 1,M
  111   C(I,JC) = A(I,JA)
  112 CONTINUE
      RETURN
C
  120 IF (JC+NU .GT. L) GO TO 240
      MCU = NU
      IF (MU .EQ. 0) GO TO 130
      DO 122 J = 1,MU
      JA = JA + 1
      JB = JB + 1
      JC = JC + 1
        DO 121 I = 1,M
  121   C(I,JC) = A(I,JA) - B(I,JB)
  122 CONTINUE
C
  130 JMAX = NU - MU
      DO 132 J = 1,JMAX
      JB = JB + 1
      JC = JC + 1
        DO 131 I = 1,M
  131   C(I,JC) = -B(I,JB)
  132 CONTINUE
      RETURN
C
  140 MCU = MU
      IF (MU .EQ. 0) RETURN
      LA = ML + MU + 1
      LB = NL + NU + 1
      DO 142 J = 1,MU
      IMAX = MIN0(M,N-MCU)
        DO 141 I = 1,IMAX
        IF (A(I,LA)-B(I,LB)) 150,141,150
  141   CONTINUE
      MCU = MCU - 1
      LA = LA - 1
  142 LB = LB - 1
      RETURN
C
  150 IF (JC+MCU .GT. L) GO TO 250
      DO 152 J = 1,MCU
      JA = JA + 1
      JB = JB + 1
      JC = JC + 1
        DO 151 I = 1,M
  151   C(I,JC) = A(I,JA) - B(I,JB)
  152 CONTINUE
      RETURN
C
C     ERROR RETURN - C REQUIRES AT LEAST IERR COLUMNS
C
  200 IERR = ML + 1
      RETURN
  210 IERR = NL + 1
      RETURN
  220 IERR = JMAX
      RETURN
  230 IERR = JC + MU
      RETURN
  240 IERR = JC + NU
      RETURN
  250 IERR = JC + MCU
      RETURN
      END
