So, whenever possible, if I’m editing some old RPG3 or RPG400 code I spend a coffee* cleaning the code up to a more readable form. Cleaning old Do Loops in RPG3 can be a head scratching experience:
(If you dont have RDi then checkout it’s predecessor WDSC7. Websphere Development Studio Client is old technology but better than nothing and if your not able to cough up $800 on IBM’s Rational Developer for i version… c’mon IBM come up with a sensible price for a source code editor. Obviously, the most sensible is $FREE.)
DO LOOPS are something that sometimes make me scratch my head when uplifting to RPG4. So just for my reference here is an example of the exact same code in RPG3, RPG400 and RPG4 (or RPG ILE as its sometimes called).
DO SAVRRN X MOVE PLOP THING X IFGT 10 FIELD1 CAT FIELD2 RESULT END END
DO SAVRRN X EVAL THING = PLOP X IFGT 10 EVAL RESULT = FIELD1 + FIELD2 ENDIF ENDDO
RPG4 – also known as RPGLE /FreeFormat
For x = 1 to SAVRRN by 1; Thing = Plop; If x > 10; Result = Field1 + Field2; Endif; EndFor;
/me loves some RPG Free format. It makes this lovely old RPG language readable and slinky 🙂
* A ‘coffee’ is the amount of time it takes to drink a regular cup of brew. This is slightly shorter than the English standard time unit of a ‘tea’ because that also has ‘biscuits’ multiplied by ‘dunk’ to take into consideration.
IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Alpha Nerd and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.
How to Install IBM Access Client Solutions (ACS)
IBM i Data Obfuscation – Making Data Foggy Murky and Squinty
How to rename Fresche (BCD) Presto Library – XL_PRESTO
What is AS400 modernization?
IBM i ACS 5250 EMULATOR FONT – and other ridiculous mumbo jumbo
IBM i SQL statement to convert or compare hundred year date format
How to compare ‘100 Year Date’ to a Timestamp – aka – Weird AS400 iSeries Date formats
Modernize AS400 iSeries Queries – Convert to IBM i SQL
Use IBM i SQL to validate email addresses in Customer Master File