    Program c06dcfe

!     C06DCF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. 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
