25 Years of RPG

Is That All There Is?

Once RPGers got a taste of using the rich built-in function library, they began to want to use a similar function interface specific to their own applications, such as ValidateCustomer or GetSalesTax as functions that could be used in expressions the same way. So subprocedures entered the language, opening the door for RPG developers everywhere to add their own functions to the library. Storing those subprocedure functions in service programs made them nearly as accessible as RPG’s built-in variety. Even open-source RPG service programs had begun to emerge to further enhance the value of RPG applications.

Dramatically reduced use of indicators—at least the 01-99 numbered variety—is another hallmark of today’s RPG code compared to the 1988 variety. The use of expressions reduced the need for many indicators. But V4R2 sounded the death knell for numbered indictors by adding built-in functions to test the results of I/O operations and error handling.

Even those DDS indicators used in display or printer files were no longer excuses for numbered indicators in RPG logic. Those can be handled in a number of different ways today, including the capability to create a special data structure that allows overriding the indicator number to a meaningful named indicator. This is important because Indicator 37 or 85 is just not as readable as “ClearSubfile” or “HiLiteError”.

When XML became the foundation for so much program-to-program communication, such as Web services and EDI-like applications, RPGers struggled to effectively parse XML even with the greatly enhanced scanning and string-handling features in RPG IV. So the compiler writers stepped up and added native XML parsing to the language. Simply build a nested data structure that reflects the XML document structure (now possible due to the data definition enhancements made in V5) and use the XML-Into operation code to retrieve the data from the XML document into the structure. For situations where XML-Into didn’t fit the bill, the XML-SAX operation code could be used.

Into the Future

The pace at which technology changes today means that there is no way the RPG compiler developers—as dedicated and talented as they are—can keep up with every need for every kind of device, both physical and virtual, that comes along. So they did the next best thing. They opened up one of the simplest RPG interfaces, file I/O, for RPG developers to write their own drivers for whatever interfaces their applications need. It’s called Open Access (OA)—a rarity in IBM naming in that it clearly describes its function!

With OA, an RPGer can use a WRITE operation code to write to anything—a browser screen, an IFS file, a data queue, a mobile device—or a CHAIN to get information from anything, such as a Web service as we illustrated in “Implementing Open Access With RPG.” One could even convert existing RPG report programs (yes, RPG still does reports, too!) to write to a browser or to a spreadsheet file in the IFS or anything else you may need. An example of doing that is in “Webulating Print Output Revisited.”

Someone—either an ISV or an RPGer in his or her own shop—first writes the driver (called a Handler) to deal with the intricacies of the interface and, from that point on, all the business applications do “ordinary” business application logic. The nitty-gritty details of the APIs needed to make the function work are hidden from the business application program, much like the RPG compiler hides the complexity of doing a keyed read with locking to a database row or parsing an entire XML document. It frees business developers to concentrate on the business logic—something RPGers are usually very well equipped to do!

We’ve only highlighted a few of the most significant features that distinguish today’s RPG language from its ancestor of 1988. We’re sure that many RPGers out there are reading this and thinking, “How could they have omitted xxxxx—my favorite feature!”

Sorry we couldn’t cover it all. Our intent was to remind everyone of how far we’ve come in 25 years of RPG and perhaps to get you thinking about what’s next in your applications and how RPG can get you there.

Feel free to join the conversation by posting your comments on our recent blog post on the subject.

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



2019 Solutions Edition

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

New and Improved XML-INTO

Namespace support makes the opcode a viable option

Authenticating on the Web

The finer points of OpenRPGUI, Part 1

The Microphone is Open

Add your voice: Should IBM i include open-source RPG tools?

IBM Systems Magazine Subscribe Box Read Now Link Subscribe Now Link iPad App Google Play Store
IBMi News Sign Up Today! Past News Letters