    Program g01dhfe

!     G01DHF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. 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
