    PROGRAM g01blfe

!      G01BLF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01blf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: peqk, pgtk, plek
       INTEGER                         :: ifail, k, l, m, n
!      .. Executable Statements ..
       WRITE (nout,*) 'G01BLF Example Program Results'
       WRITE (nout,*)

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

!      Display titles
       WRITE (nout,*) '   N   L   M   K     PLEK      PGTK      PEQK'
       WRITE (nout,*)

!      Loop over all dta
D_LP:  DO
          READ (nin,*,IOSTAT=ifail) n, l, m, k
          IF (ifail/=0) THEN
!            All data processed
             EXIT D_LP
          END IF

!         Calculate probability
          ifail = 0
          CALL g01blf(n,l,m,k,plek,pgtk,peqk,ifail)

!         Display results
          WRITE (nout,99999) n, l, m, k, plek, pgtk, peqk
       END DO D_LP

99999  FORMAT (1X,4I4,3F10.5)
    END PROGRAM g01blfe
