    PROGRAM x04adfe

!      X04ADF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : x04acf, x04adf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: iounit = 4, nout = 6
       CHARACTER (*), PARAMETER        :: fname = 'x04adfe_success.res'
!      .. Local Scalars ..
       INTEGER                         :: ifail
!      .. Executable Statements ..
       WRITE (nout,*) 'X04ADF Example Program Results'

!      Test successful open and close for write

       ifail = 0
       CALL x04acf(iounit,fname,1,ifail)

       WRITE (nout,99999)
       WRITE (iounit,99999)

       ifail = 0
       CALL x04adf(iounit,ifail)

       WRITE (nout,99998)

!      Test successful open and close for read

       ifail = 0
       CALL x04acf(iounit,fname,0,ifail)

       WRITE (nout,99997)

       ifail = 0
       CALL x04adf(iounit,ifail)

       WRITE (nout,99998)

99999  FORMAT (' OK file successfully opened for writing')
99998  FORMAT (' OK file successfully closed')
99997  FORMAT (' OK file successfully opened for reading')
    END PROGRAM x04adfe
