04
Mon, Nov
5 New Articles

REXX EHLLAPI for Client Access/400 Optimized for OS/2

General
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

[Editor’s note: Although Chris discusses an OS/2 EHLLAPI with REXX, the concepts presented here apply to Windows EHLLAPI, using a language like Visual Basic.]

You have a “green-screen” 5250 emulation session and you have a PC capable of running multiple tasks. Wouldn’t it be great if the two could interact such that the power of the PC could be used to automate routine AS/400 tasks and facilitate the creation of new applications?

They can.

A program running in an OS/2 window can actually enter keystrokes into the emulator session and retrieve command output. What makes this interaction possible is the emulator high-level language application programming interface, or EHLLAPI, which is now supported with Client Access/400 Optimized for OS/2.

EHLLAPI (pronounced e-h’lappy) has been around for some time in various forms. Versions of Communications Manager, for example, supported EHLLAPI for 5250 emulation sessions. But now, Client Access/400 Optimized for OS/2 bundles Client Access and a version of Communications Manager to provide shared folder access and emulator support all in one neat package. EHLLAPI support is provided with the Communications Manager included in this package.

This article introduces the concepts of EHLLAPI and provides a simple example of an EHLLAPI program written in REXX (a general-purpose, high-level language) to logon to the AS/400. By creating and running this example, you’ll see that REXX EHLLAPI is a simple-to-implement but powerful tool for interacting with 5250 emulation sessions.


The Many Uses of EHLLAPI

EHLLAPI allows an OS/2 program to interface directly with the emulator session much like a user does. The emulator session makes no distinction between keystrokes entered by the keyboard and those entered programmatically via the EHLLAPI interface. Further, data presented on an emulation screen with which a user interacts is equally available to the OS/2 program to copy, parse, or search.

EHLLAPI uses can be classified into three categories: automation, application, and presentation.

In its simplest operation, EHLLAPI allows tasks to be automated by simply entering keystrokes. In this capacity, EHLLAPI is known as a “Program Operator.” The OS/2 program, for example, can type an AS/400 command and “press” the Enter key. The benefit of this simple action is the minimization of errors associated with complex commands, or automating a routine task like signing on. Existing AS/400 application interfaces could easily be simplified or several routine operations consolidated. Anything that can be accomplished manually can be automated with an EHLLAPI program.

Another use of EHLLAPI is to create new applications. Without having to view or interact with the 5250 emulator, a user can automate many tasks like retrieving the current CPU utilization of a target AS/400. These routine or complex operations can be completely hidden from the user by programmatically minimizing the emulator session window while the interaction is proceeding. Figure 1 shows an example of the CPU percentage-used application running in a minimized window. Note the window title in this example has been updated for the minimized window, showing the most recently sampled data.

An OS/2 EHLLAPI program can also access the emulator session’s Presentation Manager window. For example, an emulation session title bar or minimized window caption might normally say something less than descriptive like “A - 5250 Session.” That can be updated to reflect an active logon or various stages of activity. EHLLAPI also allows you to zoom, unzoom, maximize, minimize, resize, or move emulator windows on your OS/2 desktop.

The REXX Interface

Strictly speaking, EHLLAPI is a programming interface and can be called from COBOL, C, and other compiled languages. However, Client Access/400 Optimized for OS/2 introduces a REXX interface, which makes programming considerably easier.

REXX has been included with OS/2 as far back as V1.2, and has become popular with users as a quick and easy method of creating programs. It uses an intuitive BASIC-like syntax. Many users learn it by simply reviewing existing programs. With a little effort and some help from one of the online references available with OS/2, you can become REXX-proficient in a matter of days.

REXX is also one of the languages available on the AS/400. In 1987, IBM stated that REXX was to be the procedures language for its Systems Application Architecture (SAA), solidifying its future in programming circles. Although the label “procedures language” might be a blow to its sophistication, it is a powerful language and has quite a following. Several REXX enhancements are also available, including visual programming aids (e.g., pop-ups, lists, buttons), and interfaces to facilitate TCP/IP socket programming and access to FTP functions. Even the argument that REXX is “simply an


interpreted language” is no longer strictly true, as compilers exist for many of the platforms on which REXX is implemented.

If REXX programming is familiar to you, EHLLAPI programming will be a snap. But even if it’s brand new to you, you can learn how to start taking advantage of EHLLAPI with REXX in this article. Start with the fully-functioning example and build from there. Don’t be shy about running REXX programs you’ve modified; REXX is great about pin-pointing error messages.

Running a REXX EHLLAPI Program

To run an OS/2 REXX EHLLAPI program, check these items:
• Ensure Client Access/400 Optimized for OS/2 is correctly installed.
• Include the directory PCOMOS2 in your path. PCOMOS2 contains the actual REXX EHLLAPI DLL that your program loads.

• Configure Client Access/400 Optimized for OS/2 appropriately for your environment, ensuring you have at least one 5250 emulation session defined.

• Start the emulator session.
• Open an OS/2 window and execute your program. As you develop your program, it’s a good idea to leave it zoomed and in the background behind your OS/2 window, so you can see how your program interacts with the session. You can minimize your emulator window while the REXX EHLLAPI program runs.

Conclusion

If you run the example program following this article, you’ll have an example of the power of REXX EHLLAPI. You can build on that example to automate laborious tasks you routinely perform on the AS/400, so they can be executed with no more than the double click of your mouse.

References

EHLLAPI Programming Reference, SC31-6163 (for Communications Manager/2) EHLLAPI Programming Reference, S04G-1027 (Extended Services for OS/2) Client Access/400 PC5250 Programmer’s Guide Client Access/400 RUMBA/400 Tools OS/2 Procedures Language/2 REXX (Available on soft copy in the OS/2 Information folder)

The REXX Language, A Practical Approach to Programming, Michael Cowlishaw (Prentice Hall)

The REXX Language page at IBM Hursley:http://rexx.hursley.ibm.com/ rexx/rexx.htm


REXX_EHLLAPI_for_Client_Access-_400_Optimized_for_OS-_204-00.jpg 450x337

Figure 1: Sample EHLLAPI: Retrieve CPU Percentage Used


BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: