Update
Before using what is described below consider using SQL to read IFS files.
I had a situation where I had a text file in an IFS folder and I needed to read its contents. I could have copied the file from the IFS into an IBM i library and then read it there, but I decided to investigate how I could read the file directly from the IFS using RPG. Fortunately there are three APIs which will allow me to do this.
First I need to give credit to a friend of mine, who wishes to remain anonymous, for providing a program that my example is based upon.
I created a text file using Windows' Notepad. At the end of each line I pressed Enter to create variable length records, see below, and copied the file to my folder in the IFS.