Rocket Terminal Emulator

 View Only

 Issues with executing commands on Bluezone z/vm through HLLAPI using Golang

Nikhil Parvatikar's profile image
Nikhil Parvatikar posted 12-29-2020 18:26

I am writing a software to connect to Bluezone terminal session and automate a process using EHLAPI. I am writing this software in Go lang and so far I have been successful in connecting to the bluezone session and issuing commands using SendKey() and CopyStringToPS() methods of hllapi but the behavior is not consistent. I am frequently encountering an error wherein the command that is sent to the terminal does not get applied and I see an error code mentioned below:

1 Your program is not connected to a host session.

 I see this error for the following methods in hllapi :  Send Key (3),Copy String to Presentation Space (15) and Copy String to Field (33)

This results in my application losing connection with the Bluezone terminal and any further commands issued fail with the same return code.

Could anyone please guide me in identifying if I am missing anything? 

I am referring to the following documentation to connect the Bluezone's hllapi :  https://www.ibm.com/support/knowledgecenter/SSEQ5Y_5.9.0/com.ibm.pcomm.doc/books/html/emulator_programming08.htm

 Please let me know if there is any other documentation for connecting to Bluezone's  terminal apart from the one mentioned above.

Any feedback is appreciated.

Thank you,

Nikhil Parvatikar

Mark Woodall's profile image
ROCKETEER Mark Woodall

Hello Nikhil - Happy new year!

You may need to log a support case if you have problems connecting your app to the BlueZone HLLAPI. - here is the Support page.

But first you should check the following help pages:

This is for BlueZone v8.1 BlueZone Help - Version 8.1

(- there are links for other Bluezone versions here but the script commands are generally very consistent between versions)

Specifically look for the section on  BlueZone Advanced Automation Guide

There is a page about establishing a connection to a BlueZone session using the call EMConnect

You will also find Script host sample script you could use to work on. Have fun :)

Mike Jones's profile image
ROCKETEER Mike Jones
It sounds like you need to call the prerequisite call:Connect Presentation Space (1)

This call links the hllapi object to a specific host session. Its generally only called once at the very beginning unless your software wants to switch between multiple host sessions.
Nikhil Parvatikar's profile image
Nikhil Parvatikar
Hi Mike,

I am already making a call to Connect() method of Hllapi and that command succeeds. Her is the complete sequence of steps:
1) Connect to EHLAPI64  using connect() method of hllapi
2) Send Key() for  'Enter' 
3) Send Key() for "L CMSA by CMSB"+ Enter
4) Send Key() for "password" + 'Enter'

I see that Step 1,2 and 3 are successful. I see the error 1  "Your program is not connected to a host session." for Step 4.

Please note that this is the most common sequence and there are times when Step 4 succeeds. I have also seen the same error for Step 2 and Step 3 too
Mike Jones's profile image
ROCKETEER Mike Jones
Do you have a Wait (4) call after each Send Key() ? In 3270/5250 emulation you can have issues when trying to send before the keyboard is unlocked on the next screen.
Nikhil Parvatikar's profile image
Nikhil Parvatikar
Hi Mike,

I did not have a Wait() after every SendKey(). I tried adding it and I see that the Wait() returns the same error mentioned below intermittently:

1 Your program is not connected to a host session.


Do I need to keep on calling Wait until it returns a 0? I am now trying 3 times after which the GO program errors out.
Mike Jones's profile image
ROCKETEER Mike Jones
Unless you changed the wait option through Set Session Parameters (9) the Wait (4) with TWAIT waits up to 60 seconds before timing out on XCLOCK/XSYSTEM. I doubt your host is taking more then 60 seconds after each SendKey, so one Wait is normal. I'd agree with Mark that you should create a support case to further troubleshoot this issue. Support would probably help you capture a BlueZone 3270 trace and a API trace to see if there's anything going on with the datastream that's not obvious through the HLLAPI layer. Also, "@" in SendKey is special, if you have an "@" in your password you will need to shift it out by adding an additional "@" ex: "Test@@123" to send "Test@123" to the host. I've seen that throw off hllapi code before during sign on.

​​​​SendKey("@E") //Enter
Wait()
SendKey("L CMSA by CMSB@E")
Wait()
SendKey(password@E)
Wait()
...