

When the end of the file is reached the procedure returns null, and I would want to exit the do loop. The first parameter is a pointer to the retrieved data, the second is the size I want to use for the retrieved data, and the third is just a pointer variable. Line 25: The read is performed here using the ReadFile procedure. I used the same text file and IFS folder that I had in the previous post:īefore I had used three UNIX-type APIs: open, read, and close *null) Ģ6 RtvData = %xlate(x'00':' ':RtvData) //End of record nullĢ7 RtvData = %xlate(x'25':' ':RtvData) //Line feed (LF)Ģ8 RtvData = %xlate(x'0D':' ':RtvData) //Carriage return (CR) What I found convinced me that this is the better way to read an IFS file using RPG. So I did what he suggested and investigated the C APIs he mentioned: fopen, fgets, and fclose. With these apis you don't have to scan for the crlf characters as they parse the data on those. I would also say explore the fopen, fget and fclose.


The screen capture below shows the path name, the reference count, and the type of reference in use.After publishing a post about reading an IFS file using RPG I received an interesting communication from Jeff Davis: This command returns many columns of information. When you know the job name, the IFS_JOB_INFO service will return information about object references for that job.

Using the QSYS2.IFS_OBJECT_LOCK_INFO(), you can find the job for a given object in the IFS.Īs an example, I have a simple text file in my home directory that I had opened to edit via EDTF. Using the QSYS.IFS_JOB_INFO()service, you can find the IFS object references for a given job. This is a great addition as it gives you an SQL interface to get at this information it returns information similar to the Retrieve Object References ( QP0LROR) API. Now you have another way with IBM i Services. In the blogs IBM i Access Client Solutions: IFS Propertiesand Display File Usage InformationI reviewed how you could use Access Client Solutions or Navigator for i to display usage information for files in the IFS.
