*     S17ALF Example Program Text
*     Mark 20 Release. NAG Copyright 2001.
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        (NIN=5,NOUT=6)
      INTEGER          NMAX
      PARAMETER        (NMAX=100)
      DOUBLE PRECISION ZERO
      PARAMETER        (ZERO=0.0D+0)
*     .. Local Scalars ..
      DOUBLE PRECISION A, REL
      INTEGER          I, IFAIL, MODE, N
*     .. Local Arrays ..
      DOUBLE PRECISION X(NMAX)
*     .. External Functions ..
      DOUBLE PRECISION X02AJF
      EXTERNAL         X02AJF
*     .. External Subroutines ..
      EXTERNAL         S17ALF
*     .. Intrinsic Functions ..
      INTRINSIC        SQRT
*     .. Executable Statements ..
      WRITE (NOUT,*) 'S17ALF Example Program Results'
*     Skip heading in data file
      READ (NIN,*)
      WRITE (NOUT,*)
      REL = SQRT(X02AJF())
      READ (NIN,*) A, N, MODE
      IFAIL = 0
*
      CALL S17ALF(A,N,MODE,REL,X,IFAIL)
*
      WRITE (NOUT,*) '   A   N   MODE   IFAIL          REL'
      WRITE (NOUT,*) '                          (machine-dependent)'
      WRITE (NOUT,*)
      WRITE (NOUT,99999) A, N, MODE, IFAIL, REL
      WRITE (NOUT,*)
      IF (MODE.EQ.1) THEN
         WRITE (NOUT,*) 'Leading N positive zeros of J'
      ELSE IF (MODE.EQ.2) THEN
         WRITE (NOUT,*) 'Leading N positive zeros of Y'
      ELSE IF (MODE.EQ.3) THEN
         IF (A.EQ.ZERO) THEN
            WRITE (NOUT,*) 'Leading N non-negative zeros of J'''
         ELSE
            WRITE (NOUT,*) 'Leading N positive zeros of J'''
         END IF
      ELSE IF (MODE.EQ.4) THEN
         WRITE (NOUT,*) 'Leading N positive zeros of Y'''
      END IF
      WRITE (NOUT,*)
      DO 20 I = 1, N
         WRITE (NOUT,99998) X(I)
   20 CONTINUE
      WRITE (NOUT,*)
*
      STOP
*
99999 FORMAT (1X,F4.1,I4,I7,I8,6X,1P,E9.1)
99998 FORMAT (' x = ',1P,E12.4)
      END
