    PROGRAM g01eefe

!      G01EEF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01eef, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: a, b, p, pdf, q, tol, x
       INTEGER                         :: ifail
!      .. Executable Statements ..
       WRITE (nout,*) 'G01EEF Example Program Results'
       WRITE (nout,*)

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

!      Display titles
       WRITE (nout,*) '    X        A        B        P        Q       PDF'
       WRITE (nout,*)

D_LP:  DO
          READ (nin,*,IOSTAT=ifail) x, a, b
          IF (ifail/=0) THEN
             EXIT D_LP
          END IF

!         Calculate probability
!         NB: parameter tol is no longer referenced
          ifail = -1
          CALL g01eef(x,a,b,tol,p,q,pdf,ifail)
          IF (ifail/=0) THEN
             IF (ifail/=3 .AND. ifail/=4) THEN
                EXIT D_LP
             END IF
          END IF

!         Display results
          WRITE (nout,99999) x, a, b, p, q, pdf
       END DO D_LP

99999  FORMAT (1X,6(F7.4,2X),A,I1)
    END PROGRAM g01eefe
