TechTip: What You Can Do With RPG's SPECIAL File

RPG
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 This email address is being protected from spambots. You need JavaScript enabled to view it. 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: