Are you looking to program in RPG programming language for mainframe computers? Then, you have landed on the right page.
But, before we go forward, let’s get to learn about the RPG programming language first.
RPG programming language stands for Report Program Generator. It is high-level programming used for business applications.
It’s history dates back to 1959 when IBM developed it to replicate punched card processing. It is aimed to work with IBM 1401.
RPG evolved quite nicely in the coming years and started working with other IBM systems, including the IBM i- or OS/400-based systems.
RPG still enjoys some sort of popularity to date on the IBMi operating system. The current version of RPG is RPG IV which is also known as ILE RPG.
Initially, there was a concept of a program cycle that worked like a hypothetical loop. In the loop, each record is compared to the program’s every line. This means that each line can act on the record, depending on the indicator value. This was a unique feature for RPG II language but later scrapped by the majority of RPG programmers as they shifted to the controlling program flow.
RPG IV is not for complete novices. If you are new to programming or computers, in general, then the tutorial is not for you!
Before you can get started, you need to know about quite a few basics concepts, including specification and program cycle.
Specifications play a crucial role in how you program RPG IV. There are currently seven RPG IV specifications and each one of them is optional.
These specifications define a specific set of functions where the entries become position-dependent. Their position is determined based on the chosen specification.
Also, there is an order to the specification which needs to be followed. Let’s discuss it below briefly.
Main Source section:
Apart from the specifications, you also need to learn about Cycle programming. In short, it is the cycle through which a program goes through.
The next two concepts that will help you grasp RPG programming are indicators and operation codes.
Indicators are one-byte characters. They can be set either 0 or 1 and is mainly used to determine the condition or operation result.
Operational codes are used to indicate operations including arithmetic, array, bit, and so on!
In this section, we will take a look at the ILE RPG example. The example is already discussed in detail on the IBM Knowledgebase and we are going to utilize it for better understanding.
The example goes through a payroll program that prints out the weekly employees’ pay. In this example, two disk files are used including EMPLOYEE and TRANSACT. As you might have guessed, the EMPLOYEE file contains all the employee records whereas the TRANSACT files record how many hours the employee worked.
Next, they go through a step-by-step process of defining each specification. We encourage you to go through the link shared above to learn about how it is done.
This leads us to the end of our how to program in RPG programming language for mainframe computers. So, what do you think about it? Comment below and let us know.