Program s17dlfe

!     S17DLF Example Program Text

!     Mark 26.1 Release. NAG Copyright 2016.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s17dlf
!     .. 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, m, nz
      Character (1)                    :: scal
!     .. Local Arrays ..
      Complex (Kind=nag_wp)            :: cy(n)
!     .. Executable Statements ..
      Write (nout,*) 'S17DLF Example Program Results'

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

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

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

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s17dlf(m,fnu,z,n,scal,cy,nz,ifail)

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

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