*     G05ZAF Example Program Text
*     Mark 20 Release. NAG Copyright 2001.
*     .. Parameters ..
      INTEGER          NOUT
      PARAMETER        (NOUT=6)
      INTEGER          M, N, MAXR, LDC, LWRK
      PARAMETER        (M=0,N=10000,MAXR=6,LDC=10,LWRK=34)
      DOUBLE PRECISION TOL
      PARAMETER        (TOL=0.05D0)
*     .. Local Scalars ..
      DOUBLE PRECISION CHI, DF, P
      INTEGER          I, IFAIL, NRUNS
      CHARACTER        CL
*     .. Local Arrays ..
      DOUBLE PRECISION C(LDC,MAXR), EXPECT(MAXR), WRK(LWRK), X(N)
      INTEGER          NCOUNT(MAXR)
*     .. External Subroutines ..
      EXTERNAL         G05CBF, G05FAF, G05ZAF, G08EAF
*     .. Executable Statements ..
      WRITE (NOUT,*) 'G05ZAF Example Program Results'
      CALL G05ZAF('W')
      CALL G05CBF(6*273+111)
      DO 20 I = 1, 10
         IF (I.EQ.1) THEN
            CL = 'F'
         ELSE IF (I.EQ.10) THEN
            CL = 'L'
         ELSE
            CL = 'I'
         END IF
         CALL G05FAF(0.0D0,1.0D0,N,X)
         IFAIL = -1
*
         CALL G08EAF(CL,N,X,M,MAXR,NRUNS,NCOUNT,EXPECT,C,LDC,CHI,DF,P,
     +               WRK,LWRK,IFAIL)
*
         IF (CL.NE.'L' .AND. CL.NE.'l' .AND. IFAIL.NE.0) GO TO 40
*
   20 CONTINUE
*
      IF (IFAIL.EQ.0 .OR. IFAIL.EQ.10) THEN
         WRITE (NOUT,*)
         IF (P.GE.TOL) THEN
            WRITE (NOUT,*) 'Generated sequence passes runs up test'
         ELSE
            WRITE (NOUT,*) 'Generated sequence fails runs up test'
         END IF
      END IF
   40 CONTINUE
      STOP
      END
