Program m01ncfe ! M01NCF Example Program Test ! Mark 24 Release. NAG Copyright 2012. ! .. Use Statements .. Use nag_library, Only: m01ncf ! .. Implicit None Statement .. Implicit None ! .. Parameters .. Integer, Parameter :: nin = 5, nout = 6 ! .. Local Scalars .. Integer :: i, ifail, index, ioerr, m1, m2 Logical :: first Character (6) :: item ! .. Local Arrays .. Character (6), Allocatable :: ch(:) ! .. Executable Statements .. Write (nout,*) 'M01NCF Example Program Results' ! Skip heading in data file Read (nin,*) Read (nin,*) m2 Allocate (ch(m2)) m1 = 1 Read (nin,*)(ch(i),i=m1,m2) first = .True. data: Do Read (nin,'(A)',Iostat=ioerr) item If (ioerr<0) Then Exit data End If ifail = 0 index = m01ncf(first,ch,m1,m2,item,ifail) If (first) Then Write (nout,*) Write (nout,*) 'Reference Vector is:' Write (nout,99999)(ch(i),i=m1,m2) first = .False. End If Write (nout,*) Write (nout,99998) item, index End Do data 99999 Format (10(1X,A)) 99998 Format (1X,'Search for item ',A,' returned index: ',I4) End Program m01ncfe