      SUBROUTINE ORTBND(N,J,ALF,BET,ETA,OLDETA)
C
C     .... Update the eta recurrence.
C
C     .... inputs
C     .... N      dimension of the eigenproblem
C     .... J      dimension of T
C     .... ALF    diagonal elements of the tridiagonal T
C     .... BET    off-diagonal elements of T
C     .... ETA    orthogonality estimate of Lanczos vectors at step J
C     .... OLDETA orthogonality estimate of Lanczos vectors at step J-1
C
C     .... outputs
C     .... ETA    orthogonality estimate of Lanczos vectors at step J+1
C     .... OLDETA orthogonality estimate of Lanczos vectors at step J
C
C     .... BLAS routines:    DSWAP
C
C
C     .. Scalar Arguments ..
      INTEGER           J, N
C     .. Array Arguments ..
      REAL ALF(J), BET(J), ETA(J), OLDETA(J)
C     .. Scalars in Common ..
      REAL ANORM, EPS, EPS1, EPS34, EPSN, RCEPS1, REPS,
     *                  RNM, TOL
C     .. Local Scalars ..
      REAL T
      INTEGER           I
C     .. External Subroutines ..
      EXTERNAL          DSWAP
C     .. Intrinsic Functions ..
      INTRINSIC         SIGN
C     .. Common blocks ..
      COMMON            /RDATA/RNM, ANORM, TOL, EPS, EPS1, RCEPS1, EPSN,
     *                  REPS, EPS34
C     .. Executable Statements ..
C
      IF (J.LE.1) RETURN
      T = ANORM*RCEPS1
      IF (RNM.EQ.0.0E0) THEN
         OLDETA(J-1) = T/TOL
         GO TO 40
      END IF
      IF (J.GT.2) THEN
         OLDETA(1) = (BET(2)*ETA(2)+(ALF(1)-ALF(J))*ETA(1)-BET(J)
     *               *OLDETA(1))
         OLDETA(1) = (OLDETA(1)+SIGN(T,OLDETA(1)))/RNM
      END IF
      DO 20 I = 2, J - 2
         OLDETA(I) = BET(I+1)*ETA(I+1) + (ALF(I)-ALF(J))*ETA(I) + BET(I)
     *               *ETA(I-1) - BET(J)*OLDETA(I)
         OLDETA(I) = (OLDETA(I)+SIGN(T,OLDETA(I)))/RNM
   20 CONTINUE
      OLDETA(J-1) = T/RNM
   40 CALL DSWAP(J-1,OLDETA,1,ETA,1)
      ETA(J) = EPS1
      RETURN
      END
