ASNA Mobile RPG® Reference Manual |
IBM's Open Access RPG
In 2010 IBM announced IBM i 7.1 (aka OS/400 V7R1). One of the most salient features of this release was Rational Open Access: RPG Edition (OAR). OAR enables "direct" read/write access from programs written in RPG ILE to any device or resource.
IBM also made OAR available to the previous version of OS/400, V6R1. OAR is significant because RPG programmers are able, with the help of appropriate 3rd party handlers, to directly read/write to non-traditional devices.
As of 2012, OAR is free, and only requires that certain PTFs be installed.
The next graph shows the relationship between a program, a display file and the RPG compiler.
At compile time, the RPG compiler takes the definition of fields and formats from an existing display file and embeds them into the executable. At run time, the RPG program input/output operations direct data to/from a workstation controller (actually a display file manager), the controller merges the program data with the presentation instructions of the display file to generate a 5250 data stream; green screen terminals or emulators can display the 5250 stream directly or a screen scraper can manipulate the stream to provide alternate representations of the screens.
Other clever manipulations of the 5250 data stream have been employed by screen scrapers to allow RPG programs to talk to/from other data sources like web services. The novelty of OAR is that in order to utilize RPG to talk to these other sources there is no need to scrape a screen. Instead IBM has formalized a mechanism to specify a "handler" at compile time that will be invoked at execution time in place of the workstation controller. A display file is still used at compilation time but not necessarily at run time. The following diagram shows the new setup.
The two red arrows above show the main difference introduced to the source of an application. First, the RPG code needs to be told, via a keyword on the file declaration F-spec, the name of the program or procedure (MobileRPG) that will handle the I/O requests at run time. Second, only the display file is used to obtain the data definitions at compile time, any presentation instructions are unused.