ZOC Online Help Topic:

Automation/Programming (REXX/HLLAPI/MCP/DDE) → Introduction to IBM HLLAPI for ZOC

 

About HLLAPI
HLLAPI (High Level Language Application Programming Interface) is an interface defined by IBM through which a Windows program can read the screen of a terminal session, type text and keys into it and wait for the host. Programs written for IBM Personal Communications (PCOMM) and other 3270/5250 emulators use it. With ZOC's HLLAPI DLLs such programs can work with ZOC sessions instead.

ZOC implements the non-enhanced variant of the interface. The functions are made for 3270 and 5250 sessions, but most of them also work with other emulations such as VT220 or xterm (see the list of functions below).

ZOC's interface for coding agents, zoc-mcp, is built on HLLAPI as well.

 

 

DLL Names
       
EHLAPI32.DLL
 

For 32-bit client programs, for use with the 32-bit version of ZOC.

EHLAPI64.DLL
 

For 64-bit client programs, for use with the 64-bit version of ZOC.

 

Both DLLs export one function named hllapi (lower case) with this prototype:
 

long WINAPI hllapi(LPINT pfunc, LPSTR pmem, LPINT plen, LPINT prc);
The DLLs use the non-enhanced structures from hllstr16.h, e.g. a 2-byte input for HA_CONVERT_POS_ROW_COL or 12-byte entries returned by HA_QUERY_SESSIONS. The 64-bit DLL uses the same structures, only with 64-bit pointers (HA_QUERY_SESSIONS returns 12-byte entries there as well).

 

 

Installation
ZOC installs its HLLAPI DLL (EHLAPI*.DLL) in the ZOC program folder (e.g. C:\Program Files\ZOC9). Either copy your HLLAPI program into the same folder, or let it change its current directory to the ZOC program folder before it loads the DLL with LoadLibrary, or link your program with the matching ehlapi*.lib.


 
Note: If you copy a ZOC EHLAPI*.DLL to another place (e.g. into the folder of your existing HLLAPI program), it still needs the files zaphod8dll*.dll and vcruntime140.dll from the ZOC program folder. Copy them as well, or add the ZOC program folder to the PATH environment variable.

 

 

Sessions
ZOC has to be running. Each ZOC session gets a short session id (a letter from A to Z), which is the session name that HLLAPI programs use, e.g. with HA_CONNECT_PS. HA_QUERY_SESSIONS lists the sessions.

A session is only available to HLLAPI programs if the option Allow access/remote control of this session through IBM HLLAPI is enabled in Options→Session Profile→Advanced. The option is off by default.

To see a session's id in ZOC's window title, add the placeholder %HLLAPIPSID% to the window title in Options→Program Settings→Window.

 

 

Sample Program
The HLLAPI kit contains a Visual Studio C/C++ solution with the source code of a sample program (folder hllsample). Its main.c holds the computer names and paths of our test machines (around line 90); add your computer name and paths there before you build it.

To try it, start ZOC, set the emulation in Options→Session Profile→Emulations to TN3270 and do not connect (an empty screen with a blue status bar). Then run:
 

Release64\hllsample.exe zoctest

 

 

Supported Functions
       
HA_CONNECT_PS (1)
 

Connect to a session.

HA_DISCONNECT_PS (2)
 

Disconnect from the session.

HA_SENDKEY (3)
 

Send text and keys.

HA_WAIT (4)
 

Wait until the host is ready for input.

HA_COPY_PS (5)
 

Copy the whole screen.

HA_SEARCH_PS (6)
 

Search the screen for a text.

HA_QUERY_CURSOR_LOC (7)
 

Query the cursor position.

HA_COPY_PS_TO_STR (8)
 

Copy a part of the screen.

HA_SET_SESSION_PARMS (9)
 

Set session parameters.

HA_QUERY_SESSIONS (10)
 

List the sessions.

HA_COPY_STR_TO_PS (15)
 

Write text to the screen.

HA_RESET_SYSTEM (21)
 

Reset the session parameters to their defaults.

HA_QUERY_SESSION_STATUS (22)
 

Query the type and screen size of a session.

HA_COPY_STR_TO_FIELD (33)
 

Write text into an input field.

HA_SET_CURSOR (40)
 

Set the cursor position.

HA_CONVERT_POS_ROW_COL (99)
 

Convert between a screen position and row/column.

 

In sessions with other emulations than 3270 and 5250 (e.g. VT220 or xterm), the functions 15, 33 and 40 return 10 (function not supported).

The functions cover the common cases, but not the entire specification. For example, HA_COPY_PS does not follow every combination of HA_SET_SESSION_PARMS, and HA_COPY_STR_TO_FIELD may not handle all edge cases (length versus field length).

The reference for all functions is IBM's Personal Communications 12.0 Emulator Programming (PDF).

We are very interested in your feedback. If you need something that is not implemented yet, or in case of problems, please contact EmTec support. You will get a quick and qualified response from a programmer.

 
← Back to Automation/Programming (REXX/HLLAPI/MCP/DDE)