    PROGRAM g01epfe

!      G01EPF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01epf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: d, pdl, pdu
       INTEGER                         :: ifail, ip, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: work(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G01EPF Example Program Results '
       WRITE (nout,*)

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

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

       ALLOCATE (work(n))

!      Calculate the probability
       ifail = 0
       CALL g01epf(n,ip,d,pdl,pdu,work,ifail)

!      Display results
       WRITE (nout,99999) ' Durbin-Watson statistic ', d
       WRITE (nout,*)
       WRITE (nout,99998) ' Probability for the lower bound = ', pdl
       WRITE (nout,99998) ' Probability for the upper bound = ', pdu

99999  FORMAT (1X,A,F10.4)
99998  FORMAT (1X,A,F10.4)
    END PROGRAM g01epfe
