    PROGRAM m01ccfe

!      M01CCF Example Program Text

!      Mark 23 Release. NAG Copyright 2011.

!      .. Use Statements ..
       USE nag_library, ONLY : m01ccf
!      .. Implicit None Statement ..
       IMPLICIT NONE
!      .. Parameters ..
       INTEGER, PARAMETER              :: nin = 5, nout = 6
!      .. Local Scalars ..
       INTEGER                         :: i, ifail, l1, l2, m1, m2
!      .. Local Arrays ..
       CHARACTER (12), ALLOCATABLE     :: ch(:)
!      .. Executable Statements ..
       WRITE (nout,*) 'M01CCF Example Program Results'

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

       READ (nin,*) m2
       ALLOCATE (ch(m2))

       m1 = 1

       DO i = m1, m2
          READ (nin,'(A)') ch(i)
       END DO

       l1 = 7
       l2 = 12

       ifail = 0
       CALL m01ccf(ch,m1,m2,l1,l2,'Reverse ASCII',ifail)

       WRITE (nout,*)
       WRITE (nout,99999) 'Records sorted on columns ', l1, '  to ', l2
       WRITE (nout,*)
       WRITE (nout,99998) (ch(i),i=m1,m2)

99999  FORMAT (1X,A,I2,A,I2)
99998  FORMAT (1X,A)
    END PROGRAM m01ccfe
