    PROGRAM g01dafe

!      G01DAF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01daf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: errest, etol
       INTEGER                         :: ifail, iw, n
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: pp(:), work(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G01DAF Example Program Results'
       WRITE (nout,*)

!      Set the problem size
       n = 15
       etol = 0.001E0_nag_wp

       iw = 3*n/2
       ALLOCATE (pp(n),work(iw))

!      Compute the normal scores
       ifail = 0
       CALL g01daf(n,pp,etol,errest,work,iw,ifail)

!      Display results
       WRITE (nout,99999) 'Set size = ', n
       WRITE (nout,99998) 'Error tolerance (input) = ', etol
       WRITE (nout,99998) 'Error estimate (output) = ', errest
       WRITE (nout,*) 'Normal scores'
       WRITE (nout,99997) pp(1:n)

99999  FORMAT (1X,A,I2)
99998  FORMAT (1X,A,E13.3)
99997  FORMAT (10X,5F10.3)
    END PROGRAM g01dafe
