HP RPG/XL Programmer's Guide (30318-90001)

1: 2
The Basic RPG Logic Cycle
Specifications that you enter in an RPG program are executed in the
order determined by the RPG compiler. The RPG compiler fits your
specifications into the standard logic framework, producing a complete
program.
It is important to understand the RPG-supplied logic to effectively use
many features of RPG. The RPG logic cycle has three phases which are
repeated for each record that is processed. Figure 1-1 illustrates the
three basic phases: record input (input time), total calculations/output
(total time), and detail calculations/output (detail time). The word
detail
refers to operations performed on individual input records while
total
refers to the operations performed on the results of previous
records.
See the section in this chapter titled "More About the RPG Logic Cycle"
for a detailed breakdown of the three phases of the basic RPG logic
cycle.
.
Figure 1-1. The Basic RPG Logic Cycle
Read a
record
Perform
detail Output
Specifications
Perform detail
Calculation
Specifications
Perform total
Output
Specifications
Perform total
Calculation
Specifications
Total Time
Detail Time
Input Time