A Look into IBM RPG
In the world of early computers, IBM conceived the punched-card machine “IBM 1401”. As an alternative to this system, IBM created the Report Program Generator tool, which was subsequently updated the RPG II. Since then, it has been updated to RPG IV, used as a high-level programming language for IBM’s flagship systems. RPG is still a very popular programming language within the IBM spectrum today. With RPG IV, the language continues to enable users with a powerful programming environment for business-oriented applications and IBM systems. Even if this language is only in use by such a niche audience, it should not be neglected. There are just so many features for its target audience.
Background
When RPG was first developed, its major selling point was known as the program cycle. With the program cycle, every RPG program could be executed within a loop. This loop can be applied and cross-referenced to every file it has on record. Thus, a comparison would be checked between every record and line. The idea of matching records is one that set the RPG language apart from other languages at the time. But ever since the IBM System/38 was introduced in 1979, most RPG programmers distanced themselves away from the program cycle. Programmers opted for the more conventional looping constructs we widely use today. Even then, backward compatibility for the program cycle has continued to be supported.
History
RPG programming has a long history. As IBM continues to provide support for, it will still be regarded as one of the most reliable languages. Over a few decades, many updates and versions to the language have helped IBM computer-based programmers code more efficiently.
During the RPG II era, IBM rolled out many updates to the language. This allowed the language to be easily run on the smallest systems of the time. Systems included the 1130, System/3, System/34, and System/36 computers. Something interesting about the language during its era was that it was a fixed format programming language. This meant that every line of code had to be put in the right column for a certain output.
Fast forward to the RPG III era, the language was updated to be used with the System/38 and other systems. This update added more features and could support new functions like IF END IF, DO loops, and subroutines.
RPG was updated to its fourth iteration in 1994 and had many newer enhancements over RPG III. Updates included longer field names, date and time support, new data types (floating point, boolean), built-in functions, and much more. One of RPG IV’s greater newest additions were that it is ILE compliant. This means that there a vast number of functional, performance, maintenance, and productivity improvements, something programmers would value greatly today. (programmers.io, n.d.)
RPG continues to be supported, with its current version being RPG IV Version 7, released on May 2, 2014.
Platforms
RPG is a high-level programming language that runs on the i-series and AS/400 IBM hardware. High-level languages are basically more results-oriented compared to their low-level counterparts. You do not need to tell the computer every step you need to take. Instead, you can use the language’s simplified operations and many abstractions to do a task. Low-level languages on the other hand need to constantly think about how the machine is wired and the machine code. You could say that high-level languages are more like giving commands in English. Low-level code is like giving out commands in 1s and 0s.
The I-Series and AS/400 computers from IBM are mostly known for their use in the server and business realms. Rather than being used like your traditional computer, these systems act more like a server/mainframe; they handle very intensive workloads and robust number-crunching. Furthermore, the i-series platform continues the legacy of the AS/400 systems for a good reason. The systems have proven to be reliable in business applications time and time again. There is no worrying if your i-series system might fail or if it will continue to be supported; it just works. Consequently, IBM has fittingly proclaimed the platform as “unsung heroes.” (Huntington, 2020)
Benefits and Downsides
Becoming an RPG programmer is like a double-edged sword: you have the good and the bad. Do the advantages outweigh the costs? Or should we start to move away from the ancient language and move onto something more modern? For now, I would say that the language is still great for use in business and mainframe uses. Time will tell how long the language will stay alive, though.
On one hand, becoming a proficient RPG programmer opens up many high paying opportunities. The highest-paid programmers can make up to $105,000 a year. (Glassdoor, n.d.) There is also no contest for the debate that the language and its systems are the best for business applications. (Klement, n.d.) In a business setting, you will be dealing a lot with numbers.
RPG is great for this kind of work because it can seamlessly do operations on money, rates, and quantities. The language can also keep track of records and tables, allowing for the interpretation of all kinds of dates. You will not have a problem keeping track of shipment, payment, and due dates.
The biggest selling point for RPG, though, is the language’s interpretation of integer and floating-point numbers. All programming languages can perform arithmetic on integers. But can they seamlessly work with 60-digit floating point numbers? RPG is so great for business applications because the language natively supports decimal math, no special APIs needed. (Klement, n.d.)
On the other hand, it is often argued that the language and the market for its coders is dying. Why should programmers pick the RPG language over specializing in other languages? They could instead choose to code in Java or Python, languages that many companies hire for. As the technology becomes more and more dated by the minute, so do the coders supporting the platform. Businesses running on i-series and AS/400 systems will be forced to integrate new solutions if they cannot find young talent. Only time will tell if the platform and language will die. Another problem the language exhibits is how niche it is. You are better off learning the fundamentals of programming with more mainstream languages. They are much more accessible, and you don’t have to spend hundreds and thousands of dollars on hardware. This problem goes hand-in-hand with its slow death.
Code Comparison
For such an old language, RPG is quite similar to other languages like Python and Java. They are high-level languages, after all, meaning the syntax is very similar to English.
IFxx, ANDxx, ORxx, and ELSE statements work just like the respective if, and, or, and else statements in Python. IFxx statements in RPG allow a group of calculations to be processed if a certain relationship exists between two factors. Just like Python, ANDxx and ORxx statements can be used in conjunction with IFxx statements to perform a calculation. This is only if the condition specified by the combined operations exist, though. ELSE statements also behave similarly; they only run if the conditions in IFxx are not met. An ENDIF statement must be used to close the IFxx and ELSE statements. This is different compared to Python, where indentation notates where a block of code or group has ended. (IBM, n.d.)
Here is what an IFxx statement in RPG would look like:
ABCD IFEQ EFGH
:
ELSE
:
ENDIF
What this code basically says is if ABCD is equal to EFGH, do the specified function. Else, do the other function. ENDIF notates the end of the block of code. Subjectively, I think writing and if statement in Python is easier. Here is the same piece of code but in Python:
if ABCD = EFGH:
randomFunction()
else:
randomFunction2()
Coding loops in RPG is also like Python. FOR and DO statements in RPG function the same as the for statement in Python. They both allow for code to be executed repeatedly by specifying iteration. An ENDDO and ENDFOR statement notates the end of the code block, similar to IFxx statements.
Here is an example of a DO loop in RPG.
1 DO 5
:
ENDO
Here is the same function as a FOR loop in RPG:
FOR Count = 1 to 5 ;
:
ENDFOR ;
What these statements do is repeat the underlying code 5 times, counting from 1 to 5.
A Dead Language?
There is a common misconception that RPG and the AS/400 and i-series machines are obsolete. After all, the AS/400 was made in 1988! And not only is the tech old, but a majority of its programmers reaching retirement age. With all the tell-tale signs of obsolescence, why does RPG continue to still receive support to this day?
Well, believe it or not, there still hundreds of thousands of companies that still use AS/400 technology. The platform just contains features that its market can’t neglect to utilize. The tech is scalable as it can go from a 4-core server up to 256. The tech is also reliable. There is a reason why it’s still in use, even after AS/400’s conception in 1988.
Most importantly, one of RPG and AS/400’s greatest features have been its backward compatibility. You can run code created for the AS/400 in 1988 on an IBM-i server today with little to no changes. This is why many users and companies that purchase newer IBM-i machines as an AS/400. The RPG language and AS/400 systems are not dying, and they have proven they are here to stay.
Takeaway
Initially developed as a report program generator, RPG has greatly evolved into one of the finest high-level languages today. It can easily compete with likes of COBOL and PL/I. Being a high-level language, this means that it easy to understand and learn. With so many versions, it can be seen that it has grown quite rapidly compared to other languages. And with the addition of new updates came many great and revolutionary features. Many business-oriented organizations that rely on IBM based computers do not have to worry about obsolescence. The RPG language continues to provide robust systems with their functionality.