autECLFieldList.count returns 1 and not the number of fields on the screen

367 views Asked by At

The AutEclFieldList.Count returns a 1 instead of the number of fields on the screen. This is happening in a collegues session. In my own session i receive the number 122 which seems to be correct on the total of labels and datafields.

We both have Version 12.0 with 20170427 S - 12.0.2.0 I've already set my HostCodePage to '500 Belgium MNCS' like his but it still works on my pc.

I'm comparing the mainframe settings of the 2 sessions but cant find things that make a difference.

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=
[PCOMM SCRIPT SOURCE]

Dim NumFields
Dim TextStr
Dim autECLPSObj
Dim autECLConnList
Dim ObjCtrlC

Set autECLPSObj = CreateObject("PCOMM.autECLPS")
Set autECLConnList = CreateObject("PCOMM.autECLConnList")

autECLPSObj.SetConnectionByHandle(autECLConnList(1).Handle)
autECLPSObj.autECLFieldList.Refresh
NumFields = autECLPSObj.autECLFieldList.Count

MsgBox "Numfields : " & NumFields
2

There are 2 answers

0
Danny293891 On

try specific the exact session name instead of floating number, and try to run through the automation once after each Hub Restarts. I've had similar bugs where one session didn't work and the other works within my same PC. I believe it's a HUB thing connection / session rather than coding... still haven't figure out why. It fails on the first time of almost every new Hub session.

0
user692942 On

Not an expert on IBM Host Access Class Library Automation Objects but just looking at the documentation it seems to suggest;

From autECLConnList Class in Host Access Class Library Automation Objects documentation


Refresh

The Refresh method gets a snapshot of all the started connections.

Note:

You should call this method before accessing the autECLConnList collection to ensure that you have current data.

The code above doesn't call Refresh() against the autECLConnList collection, so the other session may need the connections to be refreshed. Suggest adding;

autECLConnList.Refresh

directly after;

Set autECLConnList = CreateObject("PCOMM.autECLConnList")