    Program s21cbfe

!     S21CBF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s21cbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: cn, dn, sn, z
      Real (Kind=nag_wp)               :: ak2
      Integer                          :: ifail
!     .. Executable Statements ..
      Write (nout,*) 'S21CBF Example Program Results'

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

      Write (nout,*)

      Read (nin,*) z, ak2

      ifail = 0
      Call s21cbf(z,ak2,sn,cn,dn,ifail)

      Write (nout,*) '          Z                    AK2'
      Write (nout,99999) z, ak2
      Write (nout,*)
      Write (nout,*) '         SN                     CN', &
        '                     DN'
      Write (nout,99998) sn, cn, dn

99999 Format (1X,'(',F8.4,',',F8.4,')',5X,F10.2)
99998 Format (3(' (',F8.4,',',F8.4,')',3X))
    End Program s21cbfe
