The Missing RPG OA Puzzle Piece
March 6, 2017 Dan Burger
RPG Open Access is a technology that was introduced with much fanfare with the IBM i 7.1 release of the operating system. That was in 2010. A handful of software vendors showed what it could do by using it in their application modernization tool kits as a means to get beyond screen-scraping and actually control the user interface.
Now RPG OA is seven years old and not a lot has changed. A few more vendors have incorporated it as a method for creating user interfaces. The potential for RPG OA is mostly unrealized and it remains unrecognized by the majority of RPG programmers.
“It’s scarce, but not as scarce as it seems because what’s out there doesn’t get talked about,” says RPG OA optimist Trevor Perry. “There are two things missing from the RPG Open Access conversation. Had they been part of the conversation from the start, I think OA would have been received very differently.”
From the start, RPG OA was chosen by several vendors to help create browser interfaces for green-screen applications. Those modernization tools–first released by Profound Logic and followed by looksoftware, ASNA, and BCD–hogged the headlines and led to a misconception that open access was only a method for obtaining a graphical user interface.
What was lost, Perry says, is that all the I/O in RPG can be enhanced with open access. Therefore, a lot of value was undiscovered. Physical files, tables, and printer files all leverage IBM i input/output, just to name a few examples.
Not everyone knew this seven years ago, and many may not know it now. Illumination by IBM i marketing is more like a candle in the dark than a beacon on a hill. The word got out, Perry says, but it didn’t travel far. Most programmers weren’t interested in creating their own graphical user interface and many were angry that IBM didn’t do this work themselves and deliver it to the users.
With the focus on the user interface came the realization that developing a GUI using RPG OA was a tough assignment. The RPG program is talking to a display file and the display file has to take a lot of things into account. The application tool vendors did the work, knowing the average RPG programmer was unlikely to take on the task. Perry believes this led to the misinformed conclusion that RPG OA was overly complex.
“The first visibility of open access gained it a reputation of being very complex and required a lot of thinking. And that’s because the focus was on the user interface part of the open access equation,” Perry explains. “One of the things you can do with input/output is restructure a database. It can be done without having an impact on the existing RPG. “There’s no need to add or change logic for every program. The output handler for the database is so simple, but no one is talking about it. A database just requires output to create a table. It doesn’t require the complexity. Just needs an array of the data and the field names. It’s a simple matter of reading arrays.”
For those unfamiliar with RPG OA, a “handler” is a program that allows RPG to communicate (via the DDS I/O buffer of RPG) with resources and devices that were prohibited by the DDS limitations in the past. Any I/O operation within RPG can be sent to an RPG OA handler as opposed to being sent to the operating system.
Dan Cruikshank, a member of the DB2 for i Lab Services team has been modernizing databases for IBM midrange shops for nearly 20 years using SQL and data-centric programming. Applying RPG Open Access to this task has made it much easier, he says. There is code available that can help, and by reusing components Cruikshank transforms RPG I/O to an I/O call using the call-level interface, which has been on the platform for many years. The process eliminates rewriting code from scratch.
The benefits include enhanced developer productivity, improved application performance, attributable to reduced CPU consumption and disk I/O operations. The greatest benefit of all is keeping data on the IBM i platform.
At tech conferences like the upcoming COMMON Annual Meeting and Exposition happening from May 7 to 10 in Orlando, Florida, Perry presents a session called Open Access: Easier Than Pi. In case you don’t know, pi is the ratio of a circle’s circumference to its diameter. The ratio is 3.1415. When he wrote his sample RPG OA handler for the presentation, it took three hours and eight minutes. That’s 3:08 compared to pi, which is 3.14. Therefore, Perry postulates, writing an RPG OA handler is easier than pi. It’s a bit of a stretch, but it is a good conversation starter and probably works better than a story about how long it took to bake a pie.
In a green-screen environment, subfiles are accessed one page at a time. In an open access environment, with the right RPG framework and handler, the entire data set that was built is accessible. The performance difference is dramatic, Perry says. It eliminates the back-and-forth between the user and the host. All the data is at the user interface and every bit of data can be sorted by column.
“That is a request many users have,” Perry says. “The number of people who want this is about 100 percent. The number of people who realize an open access handler can do this is about three percent.”
At one of Perry’s Easier Than Pi sessions, attendees take away some code and the knowledge to write a handler.
“I show them how quickly and easily RPG OA can be used,” he says. “You could write one handler and plug it into all or your output,” he says. However, you would likely want to do some customizations in the various instances. One handler might work in 90 programs and that handler could be tweaked to run in three or four other programs and that handler could be tweaked again to work with six other programs. It’s like writing RPG with a fancy input parameter.”
Perry is noodling the idea of placing one of his simple handlers into the open source community as a template that programmers could use as is or build upon. He is keen on the idea that an initial RPG OA conversation with programmers will lead to the recognition that the technology has undiscovered capabilities with important benefits.
RPG OA: Open Opportunity, Open To Interpretation
RPG Open Access: You Don’t Know What You Don’t Know
I am all for KISS, keep it super simple (click, download, install and use).
There’s already an Open Access template available in the community – mine!
You can read about it here: http://www.ibmsystemsmag.com/ibmi/developer/rpg/open-access-templates/
The actual downloads are here: http://www.partner400.com/Examples/OATemplates.zip
Time Trevor and I compared notes!
Jon, I used your templates and articles to build mine. The end result is a little different – my initial handlers produce XML and HTML output. The next generation will include some DB examples.
I will be presenting my (upgraded) session at the WMCPA 2017 Spring Conference – https://wmcpaspringconference2017.sched.com/event/9vPt/rpg-open-access-write-your-own-handler
Always wanted to look into this but us COBOL’ers were left out of the equation 🙁