    Program g01eefe

!     G01EEF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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