    PROGRAM s01eafe

!      S01EAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : nag_wp, s01eaf
!      .. 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,*) 'S01EAF Example Program Results'
       WRITE (nout,*)

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

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

DATA:  DO

          READ (nin,*,IOSTAT=ioerr) z

          IF (ioerr<0) THEN
             EXIT DATA
          END IF

          ifail = -1
          w = s01eaf(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 s01eafe
