Troubleshooting for Emulator programming

You can use the following self-help information resources and tools to help you troubleshoot problems:

Partial EHLLAPI input on Z and I Emulator for Windows host screen

Truncated command text was sent to a host when using HCL Z and I Emulator for Windows.

If an EHLLAPI application sends a SYSREQ key to the host and then tries to input a command onto the host screen, sometimes only a truncated part of the command is sent to the host. This problem occurs due to lack of synchronization between the SYSREQ processing at the Z and I Emulator for Windows host side and the input of commands from the EHLLAPI application.

When the application sends a SYSREQ command to the host, the following situations occur:

As soon as the host receives the SYSREQ, it responds to Z and I Emulator for Windows with the 0x15 or NL (NewLine) code. When Z and I Emulator for Windows processes this NL command by filling the rest of the line with NULLs, and moving the cursor to the beginning of the next line.

A problem occurs when the EHLLAPI application continues to input various commands in the host screen (through the SendKeys function), even before the Z and I Emulator for Windows session has received the NL command from the host and processed it. As a result, a part of the input command is first entered onto the screen, while the NL command is processed and the cursor is moved over to the next line. Then the remaining part of the command is input on the next line. Thus, only the truncated second part of the command is sent to the host, causing erroneous results.


The solution for this problem is to force the EHLLAPI application to wait until the NL command is received and processed, before continuing to input the commands to the host screen. Once the session has notified the EHLLAPI application that the host response for SYSREQ has been processed, the EHLLAPI application can then continue with its input (because the session is now in the right state to accept new input). To accomplish this, use the following EHLLAPI function calls:

Start_Host_Notification (23)
Pause (18)
Set_Session_Parameters (9)
Query_Host_Update (24).

Possible code in the EHLLAPI application is as follows:

Also, for this Pause call to work, you must use the Set_Session_Parameters (9) function call to enable the IPAUSE option. This is required because it tells the Pause API call to return when the host notifies the session of an OIA and/or PS update.

If Pause has returned due to an OIA/PS update (host notification), it has a return value of 26. If this is the case, you are ready to send the host command. Otherwise, you must wait again for the host response.

The EHLLAPI application can continue with the command once it knows that either the OIA or the Presentation Space (or both) has been updated by the host. The QueryHostUpdate is used to check what was updated: that is, whether the OIA alone was updated (return code 21), or the PS alone was updated (return code 22) or whether both the OIA and the PS were updated (return code 23).

For example, the EHLLAPI code might resemble the following part:

Send Keys(@A@H) /* Send SYSREQ command to the host */

Start Host Notification with 'B' in byte 2 /* Enable notification to EHLLAPI application
                                              when session's OIA and/or PS are updated */

Set Session Parms with IPAUSE option /* Allow Pause to be interrupted */

Label WW:

Pause for 15 seconds /* 15 secs is a sample time-out value */

retVal = Query Host Update /* Store return value of QueryHostUpdate() into retVal */

If (retVal = 21 or 22 or 23) /* OIA and/or PS was updated */

Send Keys("Your Input Command to host") /* Send input command to host */


goto (Label WW)

Stop Host Notification /* Disable host notification */ 

This is the most appropriate solution for this problem, because the EHLLAPI application waits for the exact minimum time required to allow the session to receive and process the SYSREQ host response, before sending its command input.

Another solution is to add a delay [for example, Sleep(1000)] in the EHLLAPI application between the SYSREQ command and the subsequent command, so that the session has enough time to receive and process the host response. However, this solution is not the best, because the delay might be too little or might be excessive.

Refer to RFC 2355 (TN3270 Enhancements) for more information about the 3270 SYSREQ functionality.

HCL Z and I Emulator for Windows VBHLLAPI sample does not run in FDCC Windows Vista

The HCL Z and I Emulator for Windows VBHLLAPI sample uses controls provided by comdlg32.ocx, which is not installed in the Federal Desktop Core Configuration (FDCC) of Microsoft Windows Vista.
VBHLLAPI uses ActiveX and Common Dialog controls that are provided by the Microsoft comdlg32.ocx module. For security purposes, the FDCC of Windows Vista does not contain this particular module.

The FDCC version of Windows Vista is customized, and changes are not recommended.

If HLLAPI samples containing VBHLLAPI need to be run, then the comdlg32.ocx module must be copied from a standard Windows Vista machine into the \Windows\System32\ directory of the FDCC Windows Vista installation.

Then reboot the system for the change to take effect.