    PROGRAM s21bbfe

!      S21BBF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, s21bbf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: rf, x, y, z
       INTEGER                         :: ifail, ix
!      .. Intrinsic Functions ..
       INTRINSIC                          real
!      .. Executable Statements ..
       WRITE (nout,*) 'S21BBF Example Program Results'

       WRITE (nout,*)
       WRITE (nout,*) '    X      Y      Z        S21BBF'
       WRITE (nout,*)

DATA:  DO ix = 1, 3
          x = real(ix,kind=nag_wp)*0.5E0_nag_wp
          y = real(ix+1,kind=nag_wp)*0.5E0_nag_wp
          z = real(ix+2,kind=nag_wp)*0.5E0_nag_wp

          ifail = -1
          rf = s21bbf(x,y,z,ifail)

          IF (ifail<0) THEN
             EXIT DATA
          END IF

          WRITE (nout,99999) x, y, z, rf
       END DO DATA

99999  FORMAT (1X,3F7.2,F12.4)
    END PROGRAM s21bbfe
