    PROGRAM g01dhfe

!      G01DHF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : g01dhf, nag_wp
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: ifail, n
       CHARACTER (20)                  :: scores, ties
!      .. Local Arrays ..
       REAL (KIND=nag_wp), ALLOCATABLE :: r(:), x(:)
       INTEGER, ALLOCATABLE            :: iwrk(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'G01DHF Example Program Results'
       WRITE (nout,*)

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

!      Read in the problem size
       READ (nin,*) scores, ties, n

       ALLOCATE (r(n),x(n),iwrk(n))

!      Read in data
       READ (nin,*) x(1:n)

!      Compute ranks
       ifail = 0
       CALL g01dhf(scores,ties,n,x,r,iwrk,ifail)

!      Display results
       WRITE (nout,*) 'Scores: ', scores
       WRITE (nout,*) 'Ties  : ', ties
       WRITE (nout,*)
       WRITE (nout,99999) r(1:n)

99999  FORMAT (1X,F10.4)
    END PROGRAM g01dhfe
