*     G08CDF Example Program Text
*     Mark 20 Revised. NAG Copyright 2001.
*     Mark 20 Revised. NAG Copyright 2001.
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        (NIN=5,NOUT=6)
      INTEGER          NMAX, MMAX
      PARAMETER        (NMAX=100,MMAX=50)
*     .. Local Scalars ..
      DOUBLE PRECISION D, P, Z
      INTEGER          IFAIL, IGEN, M, N, NTYPE
*     .. Local Arrays ..
      DOUBLE PRECISION SX(NMAX), SY(MMAX), X(NMAX), Y(MMAX)
      INTEGER          ISEED(4)
*     .. External Subroutines ..
      EXTERNAL         G05KBF, G05LGF, G08CDF
*     .. Executable Statements ..
      WRITE (NOUT,*) 'G08CDF Example Program Results'
*     Skip heading in data file
      READ (NIN,*)
      READ (NIN,*) N, M
      WRITE (NOUT,*)
      IF (N.LE.NMAX .AND. M.LE.MMAX) THEN
         IGEN = 0
         ISEED(1) = 0
         CALL G05KBF(IGEN,ISEED)
         IFAIL = 0
         CALL G05LGF(0.0D0,2.0D0,N,X,IGEN,ISEED,IFAIL)
         CALL G05LGF(0.25D0,2.25D0,M,Y,IGEN,ISEED,IFAIL)
         READ (NIN,*) NTYPE
         IFAIL = -1
*
         CALL G08CDF(N,X,M,Y,NTYPE,D,Z,P,SX,SY,IFAIL)
*
         IF (IFAIL.NE.0) WRITE (NOUT,99999) '** IFAIL = ', IFAIL
         WRITE (NOUT,99998) 'Test statistic D = ', D
         WRITE (NOUT,99998) 'Z statistic      = ', Z
         WRITE (NOUT,99998) 'Tail probability = ', P
      ELSE
         WRITE (NOUT,99997) 'N or M is out of range: N = ', N,
     +     ' and M = ', M
      END IF
      STOP
*
99999 FORMAT (1X,A,I2)
99998 FORMAT (1X,A,F8.4)
99997 FORMAT (1X,A,I7,A,I7)
      END
