c-----------------------------------
c file: icsevu.f
c 
c purpose: replaces imsl routine by same name
c
c------------------------------------
      subroutine icsevu(x, y, nold, c, kjx, xnew, ynew, nnew, ier)
c
c x(nx) - nx x values ordered x(i) < x(i+1)
c y(nx) - nx y values that were used to generate c
c c(nx-1, 3) - matrix of spline coefficients
c kjx - row dimension of c, note kjx >= nx-1
c xnew(nnew) - nnew x values were spline is to be evaluated
c ynew(nnew) - nnew y values
c nnew - number of spline evaluations
c ier - error codes:
c  ier = 0, no error detected
c  ier = 33 a xnew is < x(1)
c  ier = 34 a xnew is > x(nold)
      implicit none
      integer k, i, jer, ker, nnew, kjx, nold, ier
      real*8 x(nold), y(nold), c(kjx, 3), xnew(nnew), ynew(nnew)
      real*8 d
      do k=1,nnew
        call bcspefnd(x, nold, xnew(k), i)
	d = xnew(k) - x(i)
	ynew(k) = ((c(i,3)*d+c(i,2))*d+c(i,1))*d+y(i)
        if(xnew(k) .lt. x(1))    jer = 33
        if(xnew(k) .gt. x(nold)) ker = 34
      end do
      ier = max0(jer, ker)
      if(jer.gt.0) then
        call uertst(jer, 6hicsevu)
      end if
      if(ker.gt.0) then
        call uertst(ker, 6hicsevu)
      end if
      return
      end
