    PROGRAM c06dcfe

!      C06DCF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : c06dcf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: xmax, xmin
       INTEGER                         :: i, ifail, lx, n, s
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: c(:), res(:), x(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'C06DCF Example Program Results'
!      Skip heading in data file
       READ (nin,*)
       READ (nin,*) n, lx
       ALLOCATE (c(n),res(lx),x(lx))

       READ (nin,*) x(1:lx)
       READ (nin,*) xmin, xmax
       READ (nin,*) s
       READ (nin,*) c(1:n)

!      ifail: behaviour on error exit   
!             =0 for hard exit, =1 for quiet-soft, =-1 for noisy-soft
       ifail = 0
       CALL c06dcf(x,lx,xmin,xmax,c,n,s,res,ifail)

       WRITE (nout,*)
       WRITE (nout,*) '    x       sum of series'
       WRITE (nout,*)
       WRITE (nout,99999) (x(i),res(i),i=1,lx)

99999  FORMAT (1X,F8.4,4X,F8.4)
    END PROGRAM c06dcfe
