Problem solve Get help with specific problems with your technologies, process and projects.

A program to access stored text files

I would like to find out whether it is possible to write a program using RPG LE or CL to access text files stored in folders on Windows NT. I'd like to write directly to a DB2 file (flat file) on iSeries. i.e., there are three text files in the folder, and my RPGLE/CL programs are to read all three text files and write to the DB2 file in iSeries.
I have done this myself recently and used an excellent article from Scott Klement in iSeries News magazine, "RPG and the IFS; Text Files in the World". (You may have to subscribe to review these articles and to download the code.)

I also used other articles by Scott: "Don't Submit, Spawn!" to execute a directory list command, and "Communicating through a Pipe" to read the directory listing in my program. These articles are also available on the iSeries Network website, and came through Club Tech Programming Tips to those who subscribe to them. I have created a *MODULE object containing all the relevant procedures (and a few more). You can view the source code here.


The Best Web Links: tips, tutorials and more.

Visit the ITKnowledge Exchange and get answers to your developing questions fast.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.

Dig Deeper on RPG iSeries programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.