Take advantage of global, static, and non-static variable attributes within subroutines and procedures.
Written by Tom Snyder
IBM has always been good at giving us all the tools that we need in one box and ensuring that they run on the box reliably and efficiently. Since RPG has evolved into the ILE environment, we have been given more capabilities in the realm of modular coding and encapsulation. With these new capabilities, you have to learn about what you're gaining, what you're losing, and what all the nuances are of the different coding styles. In this article, I intend to describe the scoping and attributes of variables with RPG procedures.
The QDFRTVFD API provides pretty much everything you could want to know about a display file.
Written by Bruce Vining
When developing an application program, I tend to avoid hard-coding program values such as the limit value of a FOR operation. For instance, rather than hard-coding a FOR X TO 10, I might replace the 10 with an appropriate built-in, such as %size(Y), %len(Y), %elem(Y), etc. If Y has to double in size in the future, I much prefer changing the definition of Y and allowing a recompile of the program to take care of the details of loop control rather than having to search through the code and perhaps changing one or more occurrences of 10 to 20.