Program s17dcfe

!     S17DCF Example Program Text

!     Mark 25 Release. NAG Copyright 2014.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s17dcf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: n = 2, nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: z
      Real (Kind=nag_wp)               :: fnu
      Integer                          :: ifail, ioerr, nz
      Character (1)                    :: scal
!     .. Local Arrays ..
      Complex (Kind=nag_wp)            :: cwrk(n), cy(n)
!     .. Executable Statements ..
      Write (nout,*) 'S17DCF Example Program Results'

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

      Write (nout,*)
      Write (nout,99999) 'Calling with N =', n
      Write (nout,*)
      Write (nout,*) &
        '   FNU            Z        SCAL       CY(1)              CY(2)', &
        '        NZ'
      Write (nout,*)

data: Do
        Read (nin,*,Iostat=ioerr) fnu, z, scal

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s17dcf(fnu,z,n,scal,cy,nz,cwrk,ifail)

        Write (nout,99998) fnu, z, scal, cy(1), cy(2), nz
      End Do data

99999 Format (1X,A,I2)
99998 Format (1X,F7.4,'  (',F7.3,',',F7.3,')   ',A,2('  (',F7.3,',',F7.3,')'), &
        I4)
    End Program s17dcfe