    Program g01gbfe

!     G01GBF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: g01gbf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: delta, df, prob, t, tol
      Integer                          :: ifail, maxit
!     .. Executable Statements ..
      Write (nout,*) 'G01GBF Example Program Results'
      Write (nout,*)

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

!     Display titles
      Write (nout,*) '     T       DF    DELTA    PROB'
      Write (nout,*)

!     Use default tolerance and suggested number of iterations
      tol = 0.0E0_nag_wp
      maxit = 100

d_lp: Do
        Read (nin,*,Iostat=ifail) t, df, delta
        If (ifail/=0) Then
          Exit d_lp
        End If

!       Calculate probability
        ifail = 0
        prob = g01gbf(t,df,delta,tol,maxit,ifail)

!       Display results
        Write (nout,99999) t, df, delta, prob
      End Do d_lp

99999 Format (1X,3F8.3,F8.4)
    End Program g01gbfe
