POWER > Business Strategy > Modernization

7 Keys to Future-Proofing Your RPG Applications

RPG Future-proofing

Implementing RPG future- proofing techniques lead to applications that are not only more resilient, but also easier to maintain and enhance over time to keep up with technology. Failing to future-proof applications risks them becoming obsolete, which will inevitably result in your company wasting significant amounts of money in transitioning to other less able platforms.

These topics have all been covered before, and we’ve addressed many of them on our iDevelop blog (bit.ly/2tCwcwk). We hope consolidating these important topics in one place will provide a basis for discussions with your coworkers and management.

The following are seven elements we feel are critical to RPG success. Before we start to work our way through the list, it’s important to understand one thing: You shouldn’t consider it a failure if you cannot currently tick every box outlined here. The only sure way to fail is to do nothing and simply maintain the status quo.

1 Use Modern RPG Techniques

Modern RPG techniques go beyond simply using free-format RPG syntax. Here’s our checklist of modern RPG techniques. It’s by no means comprehensive, but it’s a good start. How many of these can you check off?

  • All my RPG/400 code has been converted to RPG IV (aka RPGLE)
  • I use meaningful, mixed case names
  • I only use numbered indicators when forced and then give them meaningful names
  • I code all my RPG (logic and declarations) in free-form
  • I use procedures to structure my code
  • I build service programs for my reusable components

All of these items make your code more readable and understandable. That’s critical not only for programmer productivity but also because code that’s easier to understand makes it more obvious where to make changes when adding new functionality or fixing problems. Readability makes code more maintainable, which, in turn, makes it more reliable because fewer mistakes will be made when making changes.

Conversion to RPG IV is a prerequisite to all the other items in our modernization checklist. Sadly, we know of relatively few shops that have converted all of their code, even though RPG IV has been around since 1994.

The next two items in the checklist relate to names—typically variable names, including indicators. AccountBalance is more obvious than ACCBAL and CUSNM should really be CustomerName—or should that be CustomerNumber? See the problem? Making the wrong assumption about the meaning of cryptic variable names often leads to errors.

Indicator numbers (such as *IN47) are inherently obtuse names. Avoid them in RPG except when unavoidable—such as O-specs and DDS display and printer files. Even then, use meaningful names via the INDDS support on the file declaration or named constants as subscripts to the *IN array or re-map the *IN array to give meaningful names.

We’ve covered the importance of free-format syntax before, including this online article where we made our case for the top five reasons to use free-format RPG (bit.ly/2buYnVG). Spoiler alert: Many (but not all) of the reasons have to do with readability.

Procedures can easily replace subroutines and because they offer the additional benefits of parameter passing and return values, local data and ease of reuse via Service Programs, they are excellent tools for structuring our RPG code.

Readability comes into play here again. Take a look at two possible ways of calling a routine to determine the day of the week of a date value:


Exsr DayOfWeek;     versus        WeekDay = DayOfWeek(deliveryDate); 

Jon Paris is a technical editor with IBM Systems Magazine and co-owner of Partner400.

Susan Gantner is a technical editor with IBM Systems Magazine and co-owner of Partner400.


comments powered by Disqus

Advertisement

Advertisement

2017 Solutions Edition

A Comprehensive Online Buyer's Guide to Solutions, Services and Education.

POWER > BUSINESS STRATEGY > MODERNIZATION

7 Keys to Future-Proofing Your RPG Applications

POWER > BUSINESS STRATEGY > MODERNIZATION

Administration Modernization Promotes Productivity

POWER > BUSINESS STRATEGY > MODERNIZATION

8 Best Practices to Be An IT Innovation Center

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store