    Program s17dgfe

!     S17DGF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: nag_wp, s17dgf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Complex (Kind=nag_wp)            :: ai, z
      Integer                          :: ifail, ioerr, nz
      Character (1)                    :: deriv, scal
!     .. Executable Statements ..
      Write (nout,*) 'S17DGF Example Program Results'

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

      Write (nout,*)
      Write (nout,*) 'DERIV           Z         SCAL           AI          NZ'
      Write (nout,*)

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

        If (ioerr<0) Then
          Exit data
        End If

        ifail = 0
        Call s17dgf(deriv,z,scal,ai,nz,ifail)

        Write (nout,99999) deriv, z, scal, ai, nz
      End Do data

99999 Format (3X,A,'   (',F8.4,',',F8.4,')   ',A,'   (',F8.4,',',F8.4,')',I4)
    End Program s17dgfe
