    PROGRAM g01effe

!      G01EFF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01eff, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: a, b, g, p
       INTEGER                         :: ifail
       CHARACTER (1)                   :: tail
!      .. Executable Statements ..
       WRITE (nout,*) 'G01EFF Example Program Results'
       WRITE (nout,*)

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

!      Display titles
       WRITE (nout,*) ' TAIL        G            A        B      Probability'
       WRITE (nout,*)

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

!         Calculate probability
          ifail = 0
          p = g01eff(tail,g,a,b,ifail)

!         Display results
          WRITE (nout,99999) tail, g, a, b, p
       END DO D_LP

99999  FORMAT (3X,A1,4X,F9.2,F13.2,F9.2,7X,F7.4)
    END PROGRAM g01effe
