       SUBROUTINE YPENT2(JDIM,KDIM,A,B,C,D,E,X,Y,F,KL,KU,JL,JU)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
       DOUBLE PRECISION LD,LD1,LD2,LDI
       DIMENSION A(JDIM,KDIM),B(JDIM,KDIM),C(JDIM,KDIM),D(JDIM,KDIM),
     *           E(JDIM,KDIM),X(JDIM,KDIM),Y(JDIM,KDIM),F(JDIM,KDIM,2)
C
C      ! START FORWARD GENERATION PROCESS AND SWEEP
C
        K = KL
        DO 10 J = JL,JU
        LD = C(J,K)
        LDI = 1./LD
        F(J,K,1) = F(J,K,1)*LDI
        F(J,K,2) = F(J,K,2)*LDI
        X(J,K) = D(J,K)*LDI
        Y(J,K) = E(J,K)*LDI
10      CONTINUE
C
        K = KL+1
        DO 20 J = JL,JU
        LD1 = B(J,K)
        LD = C(J,K) - LD1*X(J,K-1)
        LDI = 1./LD
        F(J,K,1) = (F(J,K,1) - LD1*F(J,K-1,1))*LDI
        F(J,K,2) = (F(J,K,2) - LD1*F(J,K-1,2))*LDI
        X(J,K) = (D(J,K) - LD1*Y(J,K-1))*LDI
        Y(J,K) = E(J,K)*LDI
20      CONTINUE
C
            DO 1 K = KL+2,KU-2
                DO 11 J = JL,JU
                LD2 = A(J,K)
                LD1 = B(J,K) - LD2*X(J,K-2)
                LD = C(J,K) - (LD2*Y(J,K-2) + LD1*X(J,K-1))
                LDI = 1./LD
                F(J,K,1) = (F(J,K,1) - LD2*F(J,K-2,1) - 
     *                     LD1*F(J,K-1,1))*LDI
                F(J,K,2) = (F(J,K,2) - LD2*F(J,K-2,2) - 
     *                     LD1*F(J,K-1,2))*LDI
                X(J,K) = (D(J,K) - LD1*Y(J,K-1))*LDI        
                Y(J,K) = E(J,K)*LDI
11              CONTINUE
1            CONTINUE
C
        K = KU-1
        DO 12 J = JL,JU
        LD2 = A(J,K)
        LD1 = B(J,K) - LD2*X(J,K-2)
        LD = C(J,K) - (LD2*Y(J,K-2) + LD1*X(J,K-1))
        LDI = 1./LD
        F(J,K,1) = (F(J,K,1) - LD2*F(J,K-2,1) - LD1*F(J,K-1,1))*LDI
        F(J,K,2) = (F(J,K,2) - LD2*F(J,K-2,2) - LD1*F(J,K-1,2))*LDI
        X(J,K) = (D(J,K) - LD1*Y(J,K-1))*LDI
12      CONTINUE
C
                K = KU
                DO 22 J = JL,JU
                LD2 = A(J,K)
                LD1 = B(J,K) - LD2*X(J,K-2)
                LD = C(J,K) - (LD2*Y(J,K-2) + LD1*X(J,K-1))
                LDI = 1./LD
                F(J,K,1) = (F(J,K,1) - LD2*F(J,K-2,1) - 
     *                     LD1*F(J,K-1,1))*LDI
                F(J,K,2) = (F(J,K,2) - LD2*F(J,K-2,2) - 
     *                      LD1*F(J,K-1,2))*LDI
22              CONTINUE
C
C        !  BACK SWEEP SOLUTION
C
        DO 32 J = JL,JU
        F(J,KU,1) = F(J,KU,1)
        F(J,KU,2) = F(J,KU,2)
        F(J,KU-1,1) = F(J,KU-1,1) - X(J,KU-1)*F(J,KU,1)
        F(J,KU-1,2) = F(J,KU-1,2) - X(J,KU-1)*F(J,KU,2)
32      CONTINUE
C
        DO 2 K = 2,KU-KL
           KX = KU-K
           DO 13 J = JL,JU
           F(J,KX,1) = F(J,KX,1) - X(J,KX)*F(J,KX+1,1) - 
     *                 Y(J,KX)*F(J,KX+2,1)
           F(J,KX,2) = F(J,KX,2) - X(J,KX)*F(J,KX+1,2) - 
     *                 Y(J,KX)*F(J,KX+2,2)
13         CONTINUE
2       CONTINUE
C
        RETURN
        END
