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 |
Current weather
Roanoke, Virginia USA
- Overcast, mist, light rain
- Temperature: 55.4 °F
- Wind: North-Northwest, 3.5 mph
- Pressure: 1012 hPa
- Rel. Humidity: 94 %
- Visibility: 4 mi
Thu, 03/11/2010 - 19:07
Bunch of Twits
- has discovered that his mighty hammer Mjölnir is missing. — 2 days 11 hours ago
- grabs a coffee and settles down for a day of post implementation checks, project closure and user documentation... bah! — 3 days 12 hours ago
- is about to embark on an IHOP pancake eating frenzy with the sprogs... — 4 days 11 hours ago
- just watching tv, a female marine running up a beach, teagan says 'i hope shes not wearing heels because thats hard' ;) — 5 days 9 min ago
- saturday morning, determined to do no work today just gonna hang out with the kids, walk the mutts, watch movies and vejjjjjj... hurrah! — 5 days 8 hours ago
- is al about rpg3, rpg4, php, asp, IBMi, html, xml, wsdl's and any other acronyms I can think of.... — 6 days 20 hours ago
- is pretending to type something important to avoid listening to someone talking a load of codswallop. — 1 week 3 hours ago
- see... DOTnetnuke.... Microsoft products make my brain shout 'Uncle!' — 1 week 1 day ago
- is moving out of his PHP-Drupal comfort zone and trying to wrap his brain around PHPNuke and the wonderful world of ASP.NET content manageme — 1 week 1 day ago
- cant sleep. awake since 4.30 and its Sunday morning aaargh — 1 week 4 days ago
- 1 of 8
- ››
Who's online
Finkpad's tweets
- has discovered that his mighty hammer Mjölnir is missing. — 2 days 11 hours ago
- grabs a coffee and settles down for a day of post implementation checks, project closure and user documentation... bah! — 3 days 12 hours ago
- is about to embark on an IHOP pancake eating frenzy with the sprogs... — 4 days 11 hours ago
- just watching tv, a female marine running up a beach, teagan says 'i hope shes not wearing heels because thats hard' ;) — 5 days 9 min ago
- saturday morning, determined to do no work today just gonna hang out with the kids, walk the mutts, watch movies and vejjjjjj... hurrah! — 5 days 8 hours ago
- is al about rpg3, rpg4, php, asp, IBMi, html, xml, wsdl's and any other acronyms I can think of.... — 6 days 20 hours ago
- is pretending to type something important to avoid listening to someone talking a load of codswallop. — 1 week 3 hours ago
- see... DOTnetnuke.... Microsoft products make my brain shout 'Uncle!' — 1 week 1 day ago
- is moving out of his PHP-Drupal comfort zone and trying to wrap his brain around PHPNuke and the wonderful world of ASP.NET content manageme — 1 week 1 day ago
- cant sleep. awake since 4.30 and its Sunday morning aaargh — 1 week 4 days ago
- 1 of 8
- ››

Comments
wow
Im a RPG programmer
and I dont wear sandals