You are currently on IBM Systems Media’s archival website. Click here to view our new website.


Big Changes for RPG in IBM i 7.1

Open Access and new built-in functions top the list


Did you hear there was an IBM i 7.1 announcement recently? In some IBM i announcement events in recent years, trying to glean any information about RPG language enhancements among the deluge of new features was difficult, if not impossible. That, and the fact that many shops don’t even think about installing a new release until it has "aged" a few months (or years), has caused some RPGers to barely pay attention when a new OS is released.

The 7.1 announcement is a bit different. The new Rational Open Access: RPG Edition (ROARE, anyone?) has the application-development industry abuzz with excitement. Several ISVs have already announced new tools that can take advantage of this new RPG feature and many others are working to launch their own products to exploit the new support. But if anyone thinks that with such a "big" new feature being added to the language, that’s all the Toronto-based team of RPG compiler developers had time to do, think again! Even if Open Access doesn’t float your boat, you may be interested in some of the other nice new goodies the RPG language has to offer in 7.1.

Open Access for RPG

First, let’s take a look at the Open Access announcement. Open Access is support that opens up the RPG language for people outside (or even inside) IBM to provide tighter integration between their solutions and RPG. RPG has always been about integration, flexibility and simplicity. RPG is "our" language—it belongs to IBM i programmers. Sure, IBM i can run COBOL, Java and PHP applications—and it does so very well. But if there were to be a designated "native language" on the system, many would say it should be RPG. RPG has grown up with IBM i. Today’s modern flavor of RPG is barely recognizable as the same old language of fixed column logic, lumbered with the use (and abuse) of 99 numbered indicators and a logic cycle that was well suited for printing reports on paper! Today’s RPG has kept pace with IBM i itself, which is also barely recognizable as the same platform that ran on those early white AS/400 boxes rolling off the line in Rochester. So RPG and IBM i have a lot in common; One thing is different—RPG is still called RPG (albeit RPG IV these days). The operating system—well, let’s not go there today.

But what is Open Access exactly? It’s a way of extending the RPG language using the native-language I/O operations such as READ, CHAIN, WRITE, EXFMT to perform functions way outside their traditional use with database, display and printer files. What kind things can you do with these operations using Open Access? The sky’s the limit! Because Open Access means that anyone—from major software vendors to that clever bit-twiddling programmer who works down the hall—can write programs or procedures that get control when an RPG program issues a READ or EXFMT operation to a file.

So, an EXFMT may end up displaying a browser screen instead of a traditional green-screen display file. A READ may bring in data from the IFS instead of database. A CHAIN may access random elements in an XML document. A WRITE may send an e-mail. How can all this happen? Has IBM enabled direct browser, IFS, XML and e-mail support into RPG? No, it’s done much better than that. It’s supplied the "hooks" necessary to enable anyone to write the "handlers" for those and endless other options and to integrate them into simple I/O operation codes.

Now this may be sounding familiar to those of you who’ve been following our recent articles in IBM i EXTRA. Our last two EXTRA articles have talked about how this kind of integration can already be done—in a more limited fashion—via the use of the Special Files support that’s been in RPG for decades. The new Open Access support does away with many of the old Special File limitations and makes it far easier to write truly generic handlers, thanks to the compiler supplying much more information to the OA handler than was available to Special File programs.

What would it look like to an RPG programmer writing a program that uses an OA handler? Something like this:

 FMyFile    OF   E             Disk    Handler('OASRVPGM(SENDEMAIL)')

They’d then perhaps build the contents of the e-mail in the logic, supplying the salutation, e-mail address and other content details via fields in the externally described "MyFile" file. Then when the "record" is written, the SENDEMAIL procedure in the OASRVPGM would get control and use the information to create and send the e-mail.

To the writer of the handler, this new support supplies the contents of the "record" that was written and the operation (i.e., OPEN, WRITE, CLOSE, etc.) that was performed, just as the old Special File support did. However, it also can supply the external record description, complete with the definition details of each field—way beyond what a Special File program received. And as you can see in this example, an OA handler can be either a program or a subprocedure in a service program. OA handlers are also not limited to sequential access operations as Special Files are.

So open up your minds to the possibilities of what Open Access could mean for you and your applications. For that matter, you may even discover that you can actually realize many of the items on your wish list by using the existing Special File support, long before you may be in a position to install Open Access.

By the way, the Open Access support is available for 6.1 systems as well as 7.1, so you may not have to wait as long as you thought to be able to explore the possibilities.

We should mention that the new Open Access support has an extra charge associated with it—it’s not included with the RPG compiler at 7.1. But for the flexibility and simplicity of interface that it provides, the price shouldn’t be a stumbling block to forward-thinking shops.


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.



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