RPG Evolution and Refactoring - Step 1 of 4
I've recently been writing all my new programs in RPG Free format. Attending RPGWORLD earlier this year, gave me the impetus to finally commit myself to the new and improved style of RPG coding.
I'm currently in contract at a shop that still has twenty year old programs running in production, the developers still write in RPG3 and shun any development techniques that have been introduced this century. "I havent got time to learn all that newfangled business" is the war cry. "Thats why your code is unreadable, the system runs like a dog, change management is out of control and there are so many bugs" is my silently worded response.
As an RPG programmer I am amazed that other programmers are simply not interested in learning the benefits of the latest generations of RPG. There are lots of flavours and any programmer worth his salt should be proficient in all of them: RPG2, RPG3, RPG400, RPGILE, RPG4, RPG/Freeformat
I wish IBM had simply named it RPG1-2-3-4-5 but in true befuddling IBM style the Report Program Generators language naming structure is nearly as poor as the naming standards for the System i itself.
Anyway, I digress, my task yesterday was to write a bunch of little utility programs adding up various elements of the JBA Accounts Receivable database to compare values with what was stored in the accounts hierarchy.
For example, "Does the total value of orders actually match all the orders added together?" and "How many invoices and how $much are outstanding this year by month" relatively simple to write and the first program was already written.
This first program was, quite amazingly, written in 2008! Some programmers are frozen in the land of the 1980's and refuses to move up from RPG3. The old style code works, dont get me wrong, but can be easily upgraded to a twenty year newer version which is vastly more readable, efficient and easy to maintain - in a few simple steps.
So here's the code:
Notice there are no comments, not even an author name.
I decided to take this program and upgrade it to RPG/FREE so I can show him the thought process betweens versions and hopefully entice him to write newer code: RPG Free Format is neater, easier to read and more efficient.
So, I've broken it into 3 very simple steps
Lets take the code and upgrade it to RPG/4 - Step 1








Add new comment