    PROGRAM s15ddfe

!      S15DDF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, s15ddf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       COMPLEX (KIND=nag_wp)           :: w, z
       INTEGER                         :: ifail, ioerr
!      .. Executable Statements ..
       WRITE (nout,*) 'S15DDF Example Program Results'

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

       WRITE (nout,*)
       WRITE (nout,*) '              Z                                W'

DATA:  DO
          READ (nin,*,IOSTAT=ioerr) z

          IF (ioerr<0) THEN
             EXIT DATA
          END IF

          ifail = -1
          w = s15ddf(z,ifail)

          IF (ifail<0) THEN
             EXIT DATA
          END IF

          WRITE (nout,99999) z, w
       END DO DATA

99999  FORMAT (1X,'(',F12.4,',',F12.4,')      (',F12.4,',',F12.4,')')
    END PROGRAM s15ddfe
