    PROGRAM g08cdfe

!      G08CDF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g08cdf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: d, p, z
       INTEGER                         :: ifail, n1, n2, ntype
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: sx(:), sy(:), x(:), y(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G08CDF Example Program Results'
       WRITE (nout,*)

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

!      Read in the problem size and statistic type
       READ (nin,*) n1, n2, ntype

       ALLOCATE (x(n1),y(n2),sx(n1),sy(n2))

!      Read in data
       READ (nin,*) x(1:n1)
       READ (nin,*) y(1:n2)

!      Perform test
       ifail = 0
       CALL g08cdf(n1,x,n2,y,ntype,d,z,p,sx,sy,ifail)

!      Display results
       WRITE (nout,99999) 'Test statistic D = ', d
       WRITE (nout,99999) 'Z statistic      = ', z
       WRITE (nout,99999) 'Tail probability = ', p

99999  FORMAT (1X,A,F8.4)
    END PROGRAM g08cdfe
