    PROGRAM g01gbfe

!      G01GBF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

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