Building a Bridge Between Your 5250 Programs and Valence Apps

Old UI habits die hard!  You may have developed some of the most beautifully functional and user-friendly Valence apps for your company, but the green screen legacy can still be hard to overcome. So long as your company’s operations require at least some 5250 programs to be used — as is typical for IBM i sites that have been around for a while — then persuading users to flip from Client Access over to their web browser to do, say, a quick inventory or order look-up in Valence may pose a challenge. It’s just way too tempting and easy for users to continue using the familiar green screen programs to get at the desired information. One option to address this situation is to set up your most commonly used green screen programs as individual apps running within the Valence Portal using IBM i Access for Web. But browser-based 5250 emulators or screen-scrapers can sometimes be a tough sell to users with many years experience using Client Access running natively on their PCs to interface with the company’s green screen programs.

But what if you could have the best of both worlds in the form of a seamless bridge between the 5250 emulator and the browser? More specifically, what if you could add a function key to your green screen programs that, when pressed, would open up the user’s browser and pop them into a specific Valence app? And what if that Valence app could be made to automatically receive pertinent info from the green screen, such as a product number or order number, so the user wouldn’t have to retype or copy/paste the data?

If that sounds appealing, you’ll be glad to know that just such an option is now available to Valence 4.1 sites. Valence build 4.1.20150211.0 includes a new tool you can integrate into your interactive 5250 programs so that they can automatically open the user’s browser, log into Valence and launch a specific Valence app.

To see a demonstration of this functionality in action, go to a command line, add VALENCE41 to your library list and call the simple green screen demo program EX5250INQ (note to those upgrading from a prior 4.1 build: if you get a level check, you must recompile the display file EX5250FM located in VALENCE41/QDDSSRC). The EX5250INQ program displays a subfile list of customer orders for a specific customer number, which you may optionally pass into the program as the first parm (otherwise it will default to the first customer record in DEMOCMAST).  

As part of this latest 4.1 build, the EX5250INQ demo program now includes a function key (F8) which, when pressed, opens a new browser tab and pops the user into the Customer Maintenance demo app within the Valence Portal. This demo app has also been modified to pull in the customer number passed from the 5250 program, thus making it possible to automatically bring up the maintenance window for the customer being viewed.

Green Screen-to-Valence App
EX5250INQ Demo App: Pressing F8 in the green screen sends user directly into Valence App

The source code for both sides of this green screen-to-Valence app demo are available to review and copy.  To bridge your own 5250 programs to Valence apps, you just need to make a couple minor adjustments to your RPG program and the front-end of your Valence app.

The basic steps are as follows:

  1. Add a function key or other mechanism to your green screen display file for the user to launch the Valence app (as F8 does now in EX5250INQ).
  2. When the function key is hit, have your RPG program populate the new VVDSRMT data structure with the Valence app ID to launch and any other pertinent info (such as, say, a customer number), then pass the data structure as a parameter to the VVRMTCALL program.
  3. Modify your Valence app front-end code to check for any passed in parms (i.e., the customer number) and act accordingly when found.  

Data passed either from a 5250 call or via an external URL with query parameters may be pulled in to any Valence app via Ext.getUrlParam(), which will return an object containing all the passed parameters and their values.

Note that you may need to adjust the URL that is used by this process to access the Valence Portal. The address is set in Portal Admin > Settings, “Login Method” section, in the “URL to access Valence login page” field:

Portal Admin > Settings - Ensure you have the correct URL for accessing your Valence instance
In Portal Admin > Settings, ensure you have the correct URL for accessing your Valence instance

Curious to know how this works?  When called from a 5250 program, the VVRMTCALL program creates a Valence session ID for the appropriate user and then uses an IBM i command (STRPCCMD) to run a PC command that opens the user’s default browser, jumps into the Valence Portal using the created session ID and launches the desired app. Though STRPCCMD is supported on most popular 5250 emulators, the PC commands run through it are normally restricted to 123 characters or less.

This tends to severely limit what can be passed through as a modern web URL (the Valence session ID alone is 64 characters). Valence works around this restriction by storing all the desired query parameters as session variables, then using a special abbreviated cross-reference code in the URL to get to them at login time. Note that the syntax of the command used to open a PC’s browser varies depending on the operating system being used (i.e., Windows, Mac or Linux). By default the VVRMTCALL program assumes a Windows OS is in use, but you can override this by populating a data area called VVPCTYPE, as explained in the Valence Guide. In the EX5250INQ demo program this data area can be interactively overridden by the user via the F24 key. As an alternative to launching a Valence app directly from a 5250 program, you can also use VVRMTCALL to build and return a full URL link to launch the Valence app from a browser.  The link is returned in the “URL” field of the VVDSRMT data structure, provided the “URLONLY” field is set to ‘1’. This link may be emailed to a user as a quick way to open up a Valence app and look at a specific piece of information.

We hope you find this new tool in the Valence framework useful for helping gently ease your green screen users into using your new Valence apps as they become available. CNX extends a big hat tip to Fender Musical Instruments in the UK for providing both the inspiration and technical assistance for getting this new Valence feature developed.  Cheers!