    Program s21dafe

!     S21DAF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s21daf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: y, z
      Real (Kind=nag_wp)               :: a, akp, b
      Integer                          :: ifail
!     .. Executable Statements ..
      Write (nout,*) 'S21DAF Example Program Results'

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

      Write (nout,*)
      Write (nout,*) '     Z          AKP     A', '      B                 Y'
      Write (nout,*)

      Read (nin,*) z, akp, a, b

      ifail = -1
      y = s21daf(z,akp,a,b,ifail)

      If (ifail>=0) Then
        Write (nout,99999) z, akp, a, b, y
      End If

99999 Format (1X,'(',F4.1,',',F4.1,' )',3F7.1,3X,'(',1P,E12.4,',',E12.4,' )')
    End Program s21dafe
