Example description
    Program s14bafe

!     S14BAF Example Program Text

!     Mark 26.2 Release. NAG Copyright 2017.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s14baf, x02ajf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: a, p, q, tol, x
      Integer                          :: ifail, ioerr
!     .. Executable Statements ..
      Write (nout,*) 'S14BAF Example Program Results'

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

      Write (nout,*)
      Write (nout,*) '         A           X           P           Q'

      tol = x02ajf()

data: Do
        Read (nin,*,Iostat=ioerr) a, x

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s14baf(a,x,tol,p,q,ifail)

        Write (nout,99999) a, x, p, q
      End Do data

99999 Format (1X,4F12.4)
    End Program s14bafe