    PROGRAM g01jdfe

!      G01JDF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01jdf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: c, d, prob
       INTEGER                         :: ifail, n
       CHARACTER (1)                   :: method
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: rlam(:), work(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G01JDF Example Program Results'
       WRITE (nout,*)

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

!      Read in the problem size
       READ (nin,*) n, method, d, c

       ALLOCATE (rlam(n),work(n+1))

!      Read in data
       READ (nin,*) rlam(1:n)

!      Calculate probability
       ifail = 0
       CALL g01jdf(method,n,rlam,d,c,prob,work,ifail)

!      Display results
       WRITE (nout,99999) ' Values of lambda ', rlam(1:n)
       WRITE (nout,99999) ' Value of D       ', d
       WRITE (nout,99999) ' value of C       ', c
       WRITE (nout,*)
       WRITE (nout,99998) ' Probability = ', prob

99999  FORMAT (1X,A,10F6.2)
99998  FORMAT (1X,A,F10.4)
    END PROGRAM g01jdfe
