This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Mthroutine Name(ProcessFile)
Define_Map For(*INPUT) Class(#PRIM_DC.UnicodeString) Name(#inFile)
Define_Com Class(#PRIM_IOC.FileStream) Name(#InFileStream)
Define_Com Class(#PRIM_IOC.StreamReader) Name(#StreamReader) Stream(#InFileStream)
Define_Com Class(#PRIM_DC.UnicodeString) Name(#ReadString)
#InFileStream.Path := #inFile
Dowhile Cond(#StreamReader.TryReadLine( #ReadString ))
* process the #ReadString however you need to...
* you can use #ReadString.asNativeString to convert to a standard alpha field...
Endwhile
Endroutine
note: streamreader is considerably faster than STM_FILE_OPEN + STM_FILE_READ when reading a file as well....
the path needs to be on the IFS for this to run...