The RPG Logic Cycle
The logic cycle is the backbone of the RPG programming language. Perhaps it's use has faded in recent years but it can still be used as effectively in RPGLE as it could in RPG2.
Tthe first and last time the program goes through the cycle is slightly different from all the in-between cycle runs:
Before the first record is read the first time through the cycle, the program resolves any parameters passed to it, writes the records conditioned by the First Page (1P) indicator, does file and data initialization, and processes any heading or detail output operations. This may also include printing heading lines.
During the last time a program goes through the cycle, when no more records are available, the LR (last record) indicator and L1 through L9 (control level) indicators are set on, and file and data area cleanup is done.
At the most basic level think of the logic cycle as a simple tool for handling all file reading for you. As simple breakdown of the cycle is this:

Before you get too scared
We're not going to use the Logic Cycle in these mini tutorials. As more modern structured modularized approach is our favoured technique. Phew I hear you say. But if you want to see more then a more detailed breakdown of the cycle is attached.
| Attachment | Size |
|---|---|
| RPG_Logic_Cycle.pdf | 11.82 KB |
Recent comments
- I'm using IE6 now and I can
8 hours 27 min ago - dinosaur techies
10 hours 3 sec ago - each new version of
3 days 9 hours ago - IE6 works perfectly with adsense injections
5 days 2 hours ago - Sorry - I'm using Vista 32
1 week 3 hours ago - yeah it a great tool, but I
1 week 7 hours ago - quick question
Will the new
1 week 20 hours ago - wowowowowow!!!!!!!!!!!!!
1 week 20 hours ago - Uncle Buck - you are
2 weeks 4 days ago - First Up, I'm Nicks younger
2 weeks 5 days ago

Comments
wow
Im a RPG programmer
and I dont wear sandals