Web Terminal - OpenAccess Integration

Recently we got a question about IBM's OpenAccess support. So, to understand integration possibilities, the question is what is OpenAccess?

Simply put, OpenAccess is fantastic tool that will allow RPG program to become kind of Web service providing data in HTML, XML or JSON form. It is many more than that, but let's focus on XML and JSON format.

XML and JSON format are formats natively supported by web browsers. Various JavaScript libs can process those data into useful visual representation like web reports, web charts or web forms etc...

As Green Screens Web Terminal is, well, web based and RPG program with OpenAccess Handlers are web accessible, only the sky is the limit.

In previous blogs we showed how easy is to call custom browser script from your terminal session.

Let's look at those examples first...

// start remote command organizer
STRPCO

// send screen blink + beep signal
STRPCCMD PCCMD('script:$(".view").fadeIn(50).fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50);Tn5250.OIA.beep();')                                                       

// show message box to the user
STRPCCMD PCCMD('script:Tn5250.Prompts.message(''Info'', ''Houston we have a problem'')') PAUSE(*NO)                                                      

// start printer session spool 2 web pdf (must be configured, and not already in use)
STRPCCMD PCCMD('script:Tn5250.Application.startPrinter(''PRT01'')') PAUSE(*NO)

Now, imagine you have compiled your RPG program with OpenAccess Handlers to render XML document from url link.

Green Screens Web and Mobile Terminal are fully compatible with OpenAccess in a very simple way… just call STRRMTCMD with URL link or JavaScript function call.

For example, to open XML document for monthly sales http://mysystem/sales?year=2016&month=12
we have two approaches.

Approach 1:

Open in new tab (mobile version will open inside browser)

STRPCCMD('url:http://mysystem/sales?year=2016&month=12')

Approach 2:

Call custom JavaScript code added to the web terminal through administration console.

STRPCCMD('script:salesReport(2016, 12)')

JavaScript function salesReport will execute some code which will switch web terminal to UI layer. UI layer itself can contain IFRAME element with independent charting application. By forwarding service URL address to application inside IFRAME element, UI application itself can call remote RPG program through AJAX call, retrieve data and render chart based on data.

Now, let us give you some more ideas to think about...

  1. Spool modernization - render HTML spool as described in previous blogs and add interactivity with OpenAccess URL links. For example, when user click on some record, pickup record data, retrieve additional info from OpenAccess RPG program with help of AJAX and render popup box. Or integrate with PayPal payment mechanism to automatically update record in database. This will bring interactivity to old green screens spool files.

  2. Display subfile and click support. By double clicking on any part of the screen, web terminal will send ROW/COL position to RPG program. This can be detected and according to position, we can identify which record is clicked. Then, we can call STRPCCMD with custom function call to show for example product image in separate window etc.

  3. With our screen modernization engine, use OpenAccess links as embedded inside modernized screens, clicking on action will provide you with additional record data or even direct processing integration. With this approach we have two new exciting features - modernized legacy screens and non-gui RPG programs for integrated data processing.

We hope that with ideas presented here we manage to provide a good insight into new possibilities which our web terminal gives especially when interconnected with OpenAccess services.