The article "Web SPECIAL Delivery" shows how to use a SPECIAL file as an output to the Web. I'd like to offer other ways of using a SPECIAL file in RPG. I will demonstrate how to do I/O operations on the ASCII text file in IFS using RPG I- and O-specs with a SPECIAL file (program). This method, as you will see, reduces much programming effort. All I/O operations with IFS files are transparent, which increases the clarity and maintainability of the code.
When we moved from V3R2 into V4R5, we started using SPECIAL files for a few things:
- Processing incoming data from the feeders in IFS
- Placing report files directly into IFS as an attachment to email
- Archiving data by placing it into IFS (and then copying it into CD)
- Processing Web documents and templates in the IFS, which adds more simplicity, flexibility, and visibility than processing Web documents inside the QSYS.LIB structure
- Storing daily and monthly reports in IFS for accessing them from the browser
In my examples, I'll present six separate simple cases:
- Write data to IFS file
- Read data from IFS file
- Update record/line in IFS file
- Delete record/line from IFS file
- Read from one IFS file and write its data into another IFS file
- Reorganize records in or remove deleted records from IFS text file
Under the "Possible Enhancements" portion of his article, Jim Angell said, "The main enhancement I see would be to use APIs to read HTML source directly from AS/400 IFS." I hope I fill the gap. Most of the explanations and comments in my demos are inside the code.
After you download the code (or download from backup site), first open the ClickMe1st.htm file for the demonstration of all six cases. The downloadble code also contains all source modules in text format as well as a Readme.txt file, which includes instructions on how to download source code and create objects from them. Before using this demo utility, copy QIWS/QCUSTCDT into YourLib/CUSTCDT. Create a test folder in the root of IFS MD /tmp. Place your files into that /tmp folder.
Ira I. Shapiro is an IBM Certified Specialist - AS/400 RPG Programmer who lives in Clark, New Jersey. He can be reached by email at
LATEST COMMENTS
MC Press Online