    Program g08cdfe

!     G08CDF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. 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
