PROGRAM m01ecfe ! M01ECF Example Program Text ! Mark 23 Release. NAG Copyright 2011. ! .. Use Statements .. USE nag_library, ONLY : m01dbf, m01ecf ! .. Implicit None Statement .. IMPLICIT NONE ! .. Parameters .. INTEGER, PARAMETER :: nin = 5, nout = 6 ! .. Local Scalars .. INTEGER :: i, ifail, m1, m2 ! .. Local Arrays .. INTEGER, ALLOCATABLE :: ifreq(:), irank(:) CHARACTER (6), ALLOCATABLE :: ch(:) ! .. Executable Statements .. WRITE (nout,*) 'M01ECF Example Program Results' ! Skip heading in data file READ (nin,*) READ (nin,*) m2 ALLOCATE (ifreq(m2),irank(m2),ch(m2)) m1 = 1 DO i = m1, m2 READ (nin,99999,END=20) ch(i), ifreq(i) END DO ifail = 0 CALL m01dbf(ifreq,m1,m2,'Descending',irank,ifail) ifail = 0 CALL m01ecf(ch,m1,m2,irank,ifail) WRITE (nout,*) WRITE (nout,*) 'Names in order of frequency' WRITE (nout,*) WRITE (nout,99998) (ch(i),i=m1,m2) 20 CONTINUE 99999 FORMAT (A6,I6) 99998 FORMAT (1X,A) END PROGRAM m01ecfe