Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Dagl Absent Member.
Absent Member.

Use of Stored Objects

[Migrated content. Thread originally posted on 08 June 2012]


From verson 9.0 (9.1 ?), AcuCobol handles stored objects. That is, we can send and receive objects as classes structs etc from ie. a C# method.

I am testing this, and for simpler objects I have managed to receive and handle objects correct.
But now I have a method that returns a C# Dictionary object.
This, I cannot figure out how to handle. Therefore I hope for an answer on this forum.

I have my return object in this handle:
77 hDictOperators usage is handle of Object value 0.

It is used in this call:
modify hMaventa "@GetOperators" (mav-returTabAnt)
giving hDictOperators

The object is stored in this, and I get the correct result if I ie. ask for the number of instances:
inquire hDictOperators @Count ws-teller

I can also extract the keys into another stored object, like this:
inquire hDictOperators @Keys hDictKeys

But the question is; how can I extract the keys and values into pic x - variables?

The normal way of doing this in C# is by a foreach loop. I have tried to set the object in a perform - loop in my program, but have no succeed with that.

The dictionary has in C# a method "ElementAt". Where you could set the element to act on in the dictionary. This method also have a "Key" property, and a "Value". This is what I need. But I cannot find "ElementAt", and when trying to use this I get a compiler error. I have tried to make my definition file correctly, but this method, which is an inherited method, does not show.

I have also earlier asked the support department for several months ago, of how to use inherited methods/properties in stored objects, but have not got any answer yet.

I would be very grateful if someone could give me a code example of how to extract the "Key" and "Value" propertied of the dictionary into pic x - variables.!

Regards Dagl
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.