      SUBROUTINE ASYMSL(KKK)
      IMPLICIT REAL*8(A-H,O-Z)
#include "parameter.h"
      PARAMETER(MXX=MAXNUM,MCOL=171)
      COMMON /SYMARG/ NEQ,MBAND,A(MCOL,MXX),Q(MXX)
      DATA TOLER /1.E-20/
      NBAND=MBAND+1
      NCOLS=2*NBAND-1
      GO TO (1000,2000),KKK
1000  CONTINUE
      KMIN=NBAND+1
      DO 50 N=1,NEQ
      IF(A(NBAND,N).EQ.0.0) GOTO 60
      IF(A(NBAND,N).EQ.1.0) GOTO 20
      C=1./A(NBAND,N)
      DO 10 K=KMIN,NCOLS
      IF(A(K,N).EQ.0.0) GOTO 10
      A(K,N)=C*A(K,N)
10    CONTINUE
20    CONTINUE
      DO 40 L=2,NBAND
      JJ=NBAND-L+1
      I=N+L-1
      IF(I.GT.NEQ) GOTO 40
      IF(A(JJ,I).EQ.0.0) GOTO 40
      KI=NBAND+2-L
      KF=NCOLS+1-L
      J=NBAND
      DO 30 K=KI,KF
      J=J+1
C     IF(ABS(A(JJ,I)).LT.TOLER .OR. ABS(A(J,N)).LT.TOLER) GOTO 30
      A(K,I)=A(K,I)-A(JJ,I)*A(J,N)
C     PRINT *,A(JJ,I),A(J,N)
C     IF(ABS(A(JJ,I)).LT.1.E-20) WRITE(7,*) JJ,I,A(JJ,I)
C     IF(ABS(A(J,N)).LT.1.E-20) WRITE(7,*) J,N,A(J,N)
30    CONTINUE
40    CONTINUE
50    CONTINUE
      RETURN
60    CONTINUE
C     WRITE(12,70) N,A(NBAND,N)
      WRITE(*,70) N,A(NBAND,N)
70    FORMAT(1H1,5X,' SET OF EQUATIONS MAY BE SINGULAR',//,5X,
     &'DIAGONAL TERM OF EQUATION',I5,13H IS EQUAL TO ,E15.8)
      STOP
2000  CONTINUE
      DO 130 N=1,NEQ
      IF(A(NBAND,N).EQ.0.0) GOTO 160
      IF(A(NBAND,N).EQ.1.0) GOTO 110
      Q(N)=Q(N)/A(NBAND,N)
110   CONTINUE
      DO 120 L=2,NBAND
      JJ=NBAND-L+1
      I=N+L-1
      IF(I.GT.NEQ) GOTO 120
      IF(A(JJ,I).EQ.0.0) GOTO 120
      Q(I)=Q(I)-A(JJ,I)*Q(N)
120   CONTINUE
130   CONTINUE
C
C BACK SUBSTITUTION
C
      LL=NBAND+1
      DO 150 M=1,NEQ
      N=NEQ+1-M
      DO 140 L=LL,NCOLS
      IF(A(L,N).EQ.0.0) GOTO 140
      K=N+L-NBAND
      Q(N)=Q(N)-A(L,N)*Q(K)
140   CONTINUE
150   CONTINUE
      RETURN
160   CONTINUE
C     WRITE(12,170) N,A(NBAND,N)
170   FORMAT(1H1,5X,31H SET OF EQUATIONS ARE SINGULAR ,///,5X,25HDIAGONA
     &L TERM OF EQUATION,I5,13H IS EQUAL TO ,E15.8)
      STOP
      END
