    PROGRAM e02bdfe

!      E02BDF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : e02bdf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: dint
       INTEGER                         :: ifail, ncap, ncap7
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: c(:), lamda(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'E02BDF Example Program Results'

!      Skip heading in data file
       READ (nin,*)

       READ (nin,*) ncap
       ncap7 = ncap + 7
       ALLOCATE (lamda(ncap7),c(ncap7))

       READ (nin,*) lamda(1:ncap7)
       READ (nin,*) c(1:(ncap+3))

       ifail = 0
       CALL e02bdf(ncap7,lamda,c,dint,ifail)

       WRITE (nout,*)
       WRITE (nout,99999) 'Definite integral = ', dint

99999  FORMAT (1X,A,E11.3)
    END PROGRAM e02bdfe
