Program g01effe

!     G01EFF Example Program Text

!     Mark 26 Release. NAG Copyright 2016.

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