What HLLAPI and EHLLAPI are, and when you need them
EHLLAPI lets a program read a 3270 or 5250 emulator screen and send keys to it. What it does, how it is called, its limits, and the scripting alternatives.
HLLAPI (High-Level Language Application Programming Interface) and its later form EHLLAPI are a programming interface to a terminal emulator. A program on the same PC uses it to read what is on a 3270 or 5250 screen and to type into it, as if a person were at the keyboard. It is the classic way to automate a green-screen application without changing the host program, often called screen scraping.
How it works
The program does not talk to the host. It talks to the emulator, which is already connected and signed on. The interface is a single entry point. On each call the program passes:
- a function number, for example 1 to connect to a session, 3 to send keys, 4 to wait, 5 to copy the screen, 6 to search it;
- a data buffer, the buffer's length, and a return code.
Each emulator session is a presentation space, named by a one-letter presentation space ID (PSID) from A to Z. A program connects to one, for example session A, and later calls work on that screen.
Keys are sent as mnemonics: @E is Enter, @C is Clear, @1 to @9 are PF1 to PF9. Text can be typed with Send Key or written straight into a field with Copy String to Presentation Space. Only Send Key can press the special keys. After an AID key such as Enter, the program uses Wait so that the next screen has arrived before it reads it.
The flavours
In IBM Personal Communications:
- IBM Standard EHLLAPI: the original interface,
hllapientry point. - WinHLLAPI: the same functions plus extensions for the Windows message model, including asynchronous calls.
- IBM Enhanced 32-bit EHLLAPI: the same functions with 32-bit data structures.
Any language that can call a DLL entry point can use it. That is also its main limit: the program loads the emulator's own DLL (for Personal Communications, for example PCSHLL32.DLL or EHLAPI32.DLL), so it runs on the Windows PC where that emulator runs, next to an open session.
When you need it
- A Windows program must drive an emulator session that a person also uses.
- An existing automation tool already speaks EHLLAPI.
If you are starting fresh, a scripted emulator is often simpler: it connects to the host itself, with no screen on a desktop. See Automate a 3270 session from a script: s3270, Wait and screen scraping.
Related
- Automate a 3270 session from a script: s3270, Wait and screen scraping
- AID keys
- Fields and attributes
- How a 3270 terminal works