    Program m01cbfe

!     M01CBF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

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

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

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

      m1 = 1

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

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

      Write (nout,*)
      Write (nout,*) 'Sorted numbers'
      Write (nout,*)
      Write (nout,99999)(iv(i),i=m1,m2)

99999 Format (1X,10I7)
    End Program m01cbfe
