Fixed-format and ILE RPG programs can benefit from the use of SQL statements to improve IBM i database access
by Rafael Victória-Pereira
Editor’s Note: This article is excerpted from chapter 11 of Evolve Your RPG Coding: Move from OPM to ILE ... and Beyond, by Rafael Victória-Pereira.
It’s possible to embed SQL code in your RPG programs, allowing them to interact with massive quantities of data at a time, breaking the “process-a-record-at-a-time” RPG traditional approach. Don’t get me wrong—I’m not saying that you should change the way your programs interact with every single data interaction—but some of them could probably have their performance, readability, and reliability improved by SQL. SQL statements can be placed in detail calculations, in total calculations, and in RPG subroutines.