    PROGRAM g01qtfe

!      G01QTF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : a00acf, g01qtf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       REAL (KIND=nag_wp)              :: x, y
       INTEGER                         :: ifail
!      .. Executable Statements ..
       WRITE (nout,*) 'G01QTF Example Program Results'
       WRITE (nout,*)

!      Check for valid licence prior to calling G01QTF
       IF ( .NOT. a00acf()) THEN
          WRITE (nout,*) ' ** A valid licence key was not found'

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

!         Display title
          WRITE (nout,*) '  X          Y'
          WRITE (nout,*)

D_LP:     DO
             READ (nin,*,IOSTAT=ifail) x
             IF (ifail/=0) THEN
                EXIT D_LP
             END IF

!            Compute the value of the 2nd moment of the Landau density function
             y = g01qtf(x)

!            Display results
             WRITE (nout,99999) x, y
          END DO D_LP
       END IF

99999  FORMAT (1X,F4.1,3X,1P,E12.4)
    END PROGRAM g01qtfe
