3270 Application Modernization Using OpenLegacy, Part 2: Creating the Trail File

by Frank Griffin, Senior Software Developer for Treehouse Software 

This is the second in a series of blog posts concerning the Treehouse partnership with OpenLegacy (See Part 1 here). As discussed last time, OpenLegacy is a way to wrap legacy mainframe applications for presentation to Java, Web, and Mobile clients.

We’ve already covered the conceptual workings of wrapping 3270 applications in general, so this time we’ll examine the first steps of wrapping an actual 3270 application in detail.

If you haven’t already downloaded OpenLegacy, you’ll need to do so in order to follow along in this Proof of Concept. Go to http://www.openlegacy.com and select Resources → Download. You’ll need to provide your name and an email address, which will get you a userid and password for the download site at ftp://ftp.openlegacy.org .

CICS is one of the bulwarks of legacy 3270 applications. These days, it also supports a variety of other communications protocols, but for 3270 it acts very much like a Windows/DOS/Unix command line. You type a transaction name followed by optional arguments, and hit ENTER. CICS looks up the transaction name in a table to find the application program associated with it, and runs that program. The program writes to the terminal, either in line mode or using formatted 3270 screens, and may request further input from the user and provide additional terminal output.

CICS provides a number of utility transaction names with the product. We’ll be looking at two of them today: CESN (sign on to CICS as a known user), and CEMT (general multi-purpose transaction for querying and controlling aspects of CICS). We’ll construct a demo application by connecting to CICS, signing on with the CESN transaction and issuing the transaction CEMT INQUIRE PROG(xxxxxxxx) to obtain information about a specific CICS transaction program. The input to the application will be a userid, password, and application program name. The output will be some of the data associated with that program.

Open the OpenLegacy IDE, and choose New → OpenLegacy Project. Select “Screens” as the backend solution type, “Integration Web” for the frontend solution type, “Mainframe” for the host type, and supply your host’s name or IP address:

OpenLegacy_Screens01

OpenLegacy_Screens02

Now, we need to run an emulation session to “teach” OpenLegacy how to navigate. Right-click on the project and select OpenLegacy → run-emulation. This will set several things in motion. It will start an internal web server within the IDE on port 1512 and launch an instance of your default browser with a URL of http://localhost:1512. When the browser connects to the web server, it will execute a servlet that will use the open-source s3270 scripting emulator to connect to your mainframe and report the 3270 datastream to the servlet, which will convert the screen to HTML and send it to the browser.

The result is that your browser instance will appear to be a 3270 screen, and you’ll be able to interact with it as if it were a real terminal or terminal emulator. As you do, the servlet is sitting in the middle, logging all terminal activity between you and the mainframe. On our mainframe, the first screen you’ll see is the standard VTAM Logon screen:

OpenLegacy_Screens03

We logon to CICS (the VTAM logon screen and the command you use may differ at your site), and depending on how CICS is configured, you may need to type “CESN” explicitly, or CESN may be started for you automatically:

OpenLegacy_Screens04

Fill in a valid Userid and Password, and hit ENTER:

OpenLegacy_Screens05

Clear the screen (ESC key in the browser emulator), as CICS transactions have to be invoked from a clear screen, type “CEMT INQUIRE PROG(DFHZNEP)” (DFHZNEP is a dummy network error program supplied with CICS), and hit ENTER:

OpenLegacy_Screens06

OpenLegacy_Screens07

The CEMT transaction has displayed all sorts of information about the DFHZNEP program, which is what we wanted.

At this point, we could continue with 3270 navigation to exit and signoff from CICS, but for simplicity in this example, we’ll just cut off the emulation here. This will cause OpenLegacy to disconnect the TN3270 session, which will cut us loose from CICS; if this were TSO, we’d have to follow through or risk leaving disconnected TSO sessions active.

Note that depending on the size of your browser window you may have to scroll down to make the “Logoff | Flip” links visible. Now click on “Logoff”, which will disconnect the terminal, shut down the emulator, and create the trail file which describes everything you’ve done:

OpenLegacy_Screens08

The trail file is an XML document which describes in detail your interactions with the mainframe. It will be the input to the next phase of generating the application, which will be the subject of the next post.

Treehouse Software Partners with OpenLegacy

Treehouse Software Partners with OpenLegacy

By Wayne Lashley, Chief Business Development Officer for Treehouse Software

Mainframe legacy systems, be they Software AG Adabas/Natural, CA IDMS/ADS, CA Datacom/Ideal or VSAM/COBOL, have several attributes in common:

  • They represent an enormous investment and body of proprietary business knowledge and process that are not easily replaced;
  • They are mission-critical, reliable and well-managed;
  • As originally conceived, they do not lend themselves readily to today’s common technology standards and practices: Java, REST, RPC, Web Services and mobile and Web apps — not to mention whatever is coming next.

The last point is a principal rationale for the rise of the legacy modernization industry in recent years. Various ways and means of “modernizing” legacy applications have emerged, and these are well-known and well-documented in the industry, and even here in the Treehouse Software blog and its predecessor, the Treetimes newsletter. After a few years of shakeout and consolidation, it would seem that there is little new under the sun in terms of legacy modernization practices and practitioners. But that’s not so.

It was back in 2013 when we first encountered OpenLegacy, a new entrant in the field and one with a novel approach. Nobody else in the modernization biz seems to be offering a standards-based, open-source toolkit/platform that can open up any IBM z or i legacy environment to provide Web and mobile interfaces, Web services and APIs—without migrating the legacy application or changing its code. With OpenLegacy, the value of the legacy environment can be fully leveraged in today’s technologies — and in whatever comes next.

We’ve been watching the company and its offerings evolve over the months, and Treehouse Senior Software Developer Frank Griffin participated in a technical evaluation and went through OpenLegacy training. We were all pretty impressed—so much so that we recently inked a partnering agreement with OpenLegacy to help market and deliver their solutions in North America. In the post below, Frank discusses one aspect of how OpenLegacy can be used to open up mainframe 3270 applications. Stay tuned for more posts from Frank as our OpenLegacy journey continues.


__OpenLegacy_Logo

Treehouse Software is now partnering with OpenLegacy to provide access to legacy IBM mainframe applications for a range of non-mainframe devices, including mobile phones and tablets as well as “heavier” clients like Service-Oriented Architecture (SOA) consumers.

Unlike many modernization approaches that require a commitment to migrate the legacy application in some way or at the very least require legacy application code changes, OpenLegacy adds more modern potential client populations to the existing application clients with no required changes to legacy code.

OpenLegacy is open-source, and is built using standards-based protocols and other open-source components wherever possible. The starter version is free to download, so you can get started with your testing immediately.

OpenLegacy can interact with legacy applications in several ways, but for simplicity in this initial post I’ll concentrate on just one: access to 3270-based applications.

We’ll assume that you have a 3270 application which can be made to display data required by a non-legacy client by navigating through one or more screens. The data need not all appear on a single screen, but can be spread over several screens. All you have to know is how to navigate through the application to get the data you want displayed.

OpenLegacy development starts with a developer environment which allows developers to describe:

(a) any input parameters needed to display the desired data

(b) the navigation process to arrive at a screen containing data to be captured

(c) the location on that screen of the data to be captured, as well as a description of that data

The OpenLegacy development suite runs as a plugin for the Eclipse Integrated Development Environment (IDE) or a self-contained IDE installation, which has several advantages. It allows OpenLegacy to piggyback on the rich GUI which Eclipse provides, and provides a familiar IDE environment for customer developers.

The OpenLegacy plugin opens several custom windows within Eclipse:

OpenLegacyScreen001

In the upper right, you can see a window with the current state of the 3270 emulator, which initializes at the standard initial logon screen for VTAM applications. In the upper left, you can see the directory structure which is automatically created for you when you use the OpenLegacy wizard to create a project. In project creation, you specify the target mainframe host, so OpenLegacy can open a TN3270 session to that host.

Navigation directions are entered by having OpenLegacy open a browser-based 3270 emulator which uses a captive copy of the s3270 emulator to interact with your mainframe system under OpenLegacy’s control. You use the browser-based emulator exactly as you would a 3270 terminal to log on, enter requests and input data, and do whatever a 3270 user would do to get to a screen of interest. However, because the 3270 emulator is running under OpenLegacy’s control, OpenLegacy is recording every keystroke needed for the navigation.

You can see the browser-based emulator in the following screenshot:

OpenLegacyScreen002

The browser application captures your keystrokes and feeds them to the 3270 emulator, also capturing the input and output from the emulator. These traces are referred to by OpenLegacy as “trails”, and are saved as XML files. When your project actually executes, this file is used instead of browser keystrokes to provide input to the emulator and scrape data from the emulator output.

When you’ve arrived at a screen containing data of interest, you switch from the browser window back to the OpenLegacy Eclipse GUI, and let OpenLegacy analyze the screen contents, identify the fields on the screen, and allow you to select those of interest and identify them with names and datatypes.

This navigation/selection cycle continues until you’ve identified all of the data you wish captured. At that point, you literally just push a button, and OpenLegacy will generate a complete rich web Java application which will accept whatever input is needed for the navigation through the legacy application, and then use the captive terminal emulator behind the scenes to log into the application, navigate to the screens of interest, and capture the fields of interest.

For Java developers (depending on what you’ve asked for), OpenLegacy also generates front-end web/Java code to use this application to accept input and return output using a number of mobile and web protocols, including SOA, HTTP GET/POST, or REST/JSON, making the legacy application immediately accessible to a wide range of modern devices.

Once compiled and exposed to the client community via a servlet container, these web/mobile applications accept requests in the specified input protocol, extract the input argument data, call the core Java code to drive the legacy application filling in fields and simulating keystrokes as needed, and collecting the desired output from screen fields as previously directed. The collected output is then formatted by the front-end application according to the requirements of the protocol involved, and returned as a response. Your device has no idea that it is interacting with a 3270 application, and your 3270 application has no idea that it is interacting with anything other than a 3270 terminal.

Oh, and did I mention that the Eclipse container includes a servlet container, and (since it was designed to allow developers to write/generate code and immediately compile and test it) a few additional mouse-clicks compile the generated code, create JARs and WARs and deploy them to that servlet container ? The result is that in as little as an hour from starting this process, you can be interfacing to your legacy application from your phone for testing. All you need is someone who knows how to navigate the legacy application and someone who knows how to navigate the OpenLegacy Eclipse GUI–two completely separate skill sets.

Regardless of what you are considering for the future for your legacy applications, OpenLegacy provides an immediate way to vastly increase your client population without touching a line of legacy code.

If this just seems like screen-scraping to you, look more closely. The differentiator here is the transparent creation of those front-end interfaces with no need for you to understand those technologies. Development using OpenLegacy doesn’t require you to know anything other than how to use the existing application.

In future posts, I’ll discuss other ways to access legacy applications using OpenLegacy via mainframe protocols that bypass 3270 emulation.

Contact Treehouse today for more information!

Download The New Treehouse Software White Paper on Fault-tolerant Data Sharing Between Applications and Databases

Image

Hot Topic or Hot Potato? 

Our informative new white paper, written by Wayne Lashley, Chief Business Development Officer for Treehouse Software, delves into the issues of why a well- architected, comprehensive, robust and scalable replication solution is the key to enabling legacy databases to exchange data reliably and effectively throughout the enterprise. This makes it possible for IT and business users to access corporate data regardless of where it resides. Furthermore, effective enterprise replication can be combined with other techniques to overcome technology constraints and maximize IT effectiveness.

To download this and other free white papers from Treehouse Software, visit our White Papers web page.