    Program g01eafe

!     G01EAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: g01eaf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: prob, x
      Integer                          :: ifail
      Character (1)                    :: tail
!     .. Executable Statements ..
      Write (nout,*) 'G01EAF Example Program Results'
      Write (nout,*)

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

!     Display title
      Write (nout,*) ' TAIL    X      Probability'
      Write (nout,*)

d_lp: Do
        Read (nin,*,Iostat=ifail) tail, x
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = 0
        prob = g01eaf(tail,x,ifail)

!       Display results
        Write (nout,99999) tail, x, prob
      End Do d_lp

99999 Format (3X,A1,4X,F5.2,6X,F7.4)
    End Program g01eafe
