    PROGRAM g01eafe

!      G01EAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

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