Welcome to the latest chapter of my IBM i RPGLE Operation Codes Guide. In my ongoing mission to document and clarify the wonderful IBM RPGLE language for new programmers, students and established old-school programmers looking for new styles of code (who says old dogs cant learn new tricks?!) I’m taking the IBM RPG Operation Codes and documenting them in the simplest way I can think of — listing them all and adding some hints, tips or comments along the way.
Bear with me – there are hundreds of these little B*%^&%rs and I am going to list them all, a few each day 🙂
If you’ve ever wondered what makes RPG tick, this is where the magic happens. Operation codes are the little instructions that tell your program what to do, and now we’re going to look at them in a way that’s organized and easy to follow.
A Tale of Two RPGs
RPG400 (RPG III or fixed-format RPG IV): This is the old-school version where every character had to sit neatly in its assigned column. One slip and your code looked like a crossword puzzle.
RPGLE (RPG IV, free-format): The modern version that finally lets programmers breathe. You can write code that looks like code instead of a secret message hidden in columns 6 to 80.
How The New RPGLE Lesson Chapter Works
To keep things tidy, I’ve grouped the op-codes into categories such as arithmetic, file operations, and control flow. For each opcode, you’ll see:
Description: A short explanation of what it does.
Legacy RPG400 Example: Fixed-format code for those who like to reminisce.
Modern RPGLE Example: Free-format code using /FREE and /END-FREE or fully free in later versions.
Examples are simplified. Assume that the usual background work (file definitions, variable declarations, prototypes) is already in place. In modern RPGLE, free-format starts with **FREE and uses dcl- keywords for declarations.
This chapter is here to make op-codes less intimidating and maybe even a little fun. By the end, you’ll see why free-format RPGLE feels like a breath of fresh air compared to its column-bound ancestor.
RPG Programming for Beginners
RPG is the well known programming language on the IBM i platform. Earlier versions of RPG ran on the old AS/400 and iSeries machines in decades gone by… the beauty of RPG is that it is fully backwards compatible. But, over the years RPG has evolved massively!

