      subroutine icsccu (x, y, nx, sc, ic, ierr)
C*******************************************************************************
C*                                                                             *
C*    ROUTINE NAME:  ICSCCU                                                    *
C*                                                                             *
C*    PURPOSE:  performs a one-dimensional cubic spline interpolation          *
C*                                                                             *
C*    AUTHOR:   Steve Reid - 19 October 1999                                   *
C*              S & E Computing                                                *
C*                                                                             *
C*    INPUTS:   x    - vector containing nx ascending abcissae                 *
C*              y    - vector containing nx ordinates                          *
C*              nx   - number of elements in vectors x and y (must be >= 4)    *
C*              ic   - second dimension of sc array                            *
C*                                                                             *
C*    OUTPUTS:  sc   - spline coefficient array dimensioned (nx - 1, 3)        *
C*              ierr - error code (terminal error)                             *
C*                      129 = ic < (nx - 1)                                    *
C*                      130 = nx < 4                                           *
C*                      131 = abcissae not in ascending order                  *
C*                                                                             *
C*    ROUTINES CALLED:  r8cspline, uertst                                      *
C*                                                                             *
C*    LIMITATION:   This version of icsccu requires that nx > 3, whereas the   *
C*                  previous constraint was nx > 1.                            *
C*                                                                             *
C*******************************************************************************
      implicit none
      integer i, ic, ierr, ilinx, nx
      real*8 dummy, fspl(4, nx), sc(ic, 3), wk(5 * nx), x(nx), y(nx)
      character*6 isub /'icsccu'/
c
c--Check validity of spline coefficient row dimension.
c
      if (ic .lt. nx - 1) go to 9000
c
c--Compute not-a-knot spline.
c
      do i = 1, nx
         fspl(1, i) = y(i)
      enddo
      call r8cspline (x, nx, fspl, 0, dummy, 0, dummy, wk, 5 * nx,
     &              ilinx, ierr)
      if (ierr .eq. 1) then
         ierr = 130
      elseif (ierr .eq. 2) then
         ierr = 131
      endif
      if (ierr .ne. 0) go to 9000
      do i = 1, ic
         sc(i, 1) = fspl(2, i)
         sc(i, 2) = fspl(3, i)
         sc(i, 3) = fspl(4, i)
      enddo
      go to 9990
c
c--Error exit.
c
 9000 continue
      call uertst (ierr, isub)
c
c--Normal exit.
c
 9990 continue
      return
      end
