WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ehllapiGetWindowStatus 202 Error


I have an old WINBATCH script that uses the Ehllapi Extender to log onto an IBM mainframe. I use Attachmate's Extra product for the 3270 interface. The script ran fine and I used it several times (also compiled it) in the past. However, I haven't used it a few months and just tried it again and it failed with a error 202 on a ehllapiGetWindowStatus instruction (result returned was a 0). The instruction is the same as what is in your sample (cut & pasted)and has not changed.

At first I thought it might be the extender and tried both the 34 and 44 level ones with the same error. I then tried the compiled version of the program and it failed as well (and has not been recompiled since it last worked).

Because the compiled version does not work, I am assuming that the problem is not with the extender but with the ehllapi interface. The only thing there is that I have a old version of Extra v6.7 and nothing has changed with that as well. It is the same version that I originally wrote and debugged my code on.

Since "nothing has changed", I'm a little at lost as to where to look. Have you any suggestions? I may try to reinstall Extra but I'm not sure what that might accomplish as the error does not suggest a missing dll.


Interesting. It might be helpful to see your WWWBATCH.INI file contents, as well as the snippet of code that's executing in the script when the error occurs.

In terms of nothing having changed, perhaps it's something more subtle, such as a timing issue. Perhaps there's something unusual happening in terms of the condition of the mainframe session that's causing the error to occur. Or, is there a chance that something's been changed w/respect the standard vs. enhanced interface settings in either the call to ehllapiInit() or the emulator's HLLAPI configuration settings? If there's now a mismatch between the call to ehllapiInit() and the emulator's configuration then the 202 error is a likely result.

User reply:

I had to create a scaled down copy of the program to demostrate the problem. Error:
WIL Extender Error: 202: Enhanced HLLAPI Extender: Incorrect parameters were specified or the Length is zero or greater than 128 bytes. Be sure the parameters are correct and are the right length.
Result = ehllapiGetWindowStatus(0) 
[Enhanced HLLAPI Extender]
LastError=2 "HllApiX() : WWHLL_GetWindowStatus()"
Sample program

IntControl(38,1,"J:\WinBatch\errorlog.txt",0,0) 		;Route fatal errors to a log file

KeyTAB = '@T'
KeyENTER = '@E'
KeyCLEAR = '@C'
KeyRESET = '@R'
KeyPF3 = '@3'
Username = 'xxxxxx'
Password = 'xxxxxx'
Who = 'who'
CICSLogOff = 'cesf logoff'

GoSub InitInterface
GoSub ConnectToPS
GoSub GetWindowStatus



ehllapiInit('D:\Program Files\E!PC\EHLAPI32.DLL','HLLAPI',1 | 4)
ResultCode = LastError()

TempMsg = StrCat('ehllapiInit("EHLAPI32.DLL","",1 | 4)  RC = ',ResultCode,@CRLF)
Title01 = 'Test ehllapiInit()'



ResultCode = LastError()

TempMsg = StrCat('ehllapiConnectPS("a")  RC = ',ResultCode,@CRLF)
Title01 = 'Test ehllapiConnectPS()'



Result = ehllapiGetWindowStatus(0)
ResultCode = LastError()

TempMsg = StrCat('ehllapiGetWindowStatus(0)  RC = ',ResultCode,@CRLF)

if (ResultCode == 0)
   TempMsg = StrCat(TempMsg,@CRLF,'Status Flags = ',Result[0])
     if (Result[0] & 8)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is visible.')
     if (Result[0] & 16)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is hidden.')
     if (Result[0] & 128)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is active.')
     if (Result[0] & 256)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is deactivated.')
     if (Result[0] & 1024)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is minimized.')
     if (Result[0] & 2048)
        TempMsg = StrCat(TempMsg,@CRLF,'The window is maximized.')
     TempMsg = StrCat(TempMsg,@CRLF,'X Coordinate = ',Result[1])
     TempMsg = StrCat(TempMsg,@CRLF,'Y Coordinate = ',Result[2])
     TempMsg = StrCat(TempMsg,@CRLF,'Window Width = ',Result[3])
     TempMsg = StrCat(TempMsg,@CRLF,'Window Height = ',Result[4])
     TempMsg = StrCat(TempMsg,@CRLF,'Z Order = ',Result[5])




OK, I seriously think that the standard vs. enhanced setting in your Attachmate installation has been altered and that's what I think is causing this problem. The error code you're getting is usually caused by the EHLLAPI extender and the emulator's HLLAPI implementation disagreeing about what mode is being used [standard vs. enhanced]. This type of issue results in incorrect parameter values being passed into the underlying HLLAPI implementation.

From the help topic for "ehllapiInit()":

Attachmate myExtra! Enterprise [v7.0]

hllapi-dll = "EHLAPI32.DLL"

hllapi-func = "hllapi"

personality-flags = 0 | 4 = 4 (*NOTE*)

Attachmate can be configured to use either the standard or enhanced HLLAPI interface specifications. This is a global setting in Attachmate and it affects all of the terminal emulator sessions that are running on a given workstation. Bit #0 should be enabled in the personality-flags [e.g. 1 | 4 = 5] if Attachmate has been been configured to use the enhanced HLLAPI interface specifications.

The setting is a global setting, not one that is specific to any particular emulator session that you have configured. It is highly likely that the emulator was switched into standard mode from enhanced mode for the HLLAPI interface API, and now the change is affecting your emulator session & your script that was previously executing properly.

User Reply:

Thanks, that was it. I've tried the different combinations between Extra's configuration and my initialization and it is working better. I hadn't thought about looking at those parameters because it was bringing up Extra fine (evidence that the basic interface was working) and failing only on the screen status request.


I'm glad you got that particular problem resolved. Yes, you're correct, the "basic" functions would work OK because, internally, they use the exact same parameters regardless of whether the standard or enhanced mode is being used. However, when it comes time to obtain a binary "blob" of data in a buffer, the size of the buffer and the locations of data items with the buffer will vary significantly depending on whether standard or enhanced mode is being used. This is what was causing you grief, since ehllapiInit() was setting the extender up for enhanced mode and the emulator was globally configured to use standard mode. At least in that configuration you typically only get a 202 error. If you mix things up the other way, there's a slim chance in certain situations where you'll actually get a program crash due to an access violation.
Article ID:   W16827
File Created: 2017:07:28:13:58:28
Last Updated: 2007:07:03:14:26:26