NAG Library Manual, Mark 27.2
Interfaces:  FL   CL   CPP   AD 

NAG FL Interface Introduction
Example description
    Program m01dbfe

!     M01DBF Example Program Text

!     Mark 27.2 Release. NAG Copyright 2021.

!     .. Use Statements ..
      Use nag_library, Only: m01dbf
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: i, ifail, m1, m2
!     .. Local Arrays ..
      Integer, Allocatable             :: irank(:), iv(:)
!     .. Executable Statements ..
      Write (nout,*) 'M01DBF Example Program Results'

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

      Read (nin,*) m2
      Allocate (irank(m2),iv(m2))

      m1 = 1

      Read (nin,*)(iv(i),i=m1,m2)

      ifail = 0
      Call m01dbf(iv,m1,m2,'Descending',irank,ifail)

      Write (nout,*)
      Write (nout,*) '   Data   Ranks'
      Write (nout,*)

      Do i = m1, m2
        Write (nout,99999) iv(i), irank(i)
      End Do

99999 Format (1X,2I7)
    End Program m01dbfe