Highlighted
Absent Member.
Absent Member.
1523 views

[archive] ActiveX Variant Datatype

[Migrated content. Thread originally posted on 29 October 2004]

Hi there.

I have a working ActiveX dll - created in VB6 - uses ADO.

I have a method in the dll that has a return type of variant - is there a technique to get that data into AcuBench GT 6.10?

How to setup the data type in AcuBench?

The variant is actually returning a 2 demi array - the data is a
result of a SQL select statement and as such may have varying
numbers of columns and rows from use to use.

Thanks

Brent McLauchlan
0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Variant Datatype

You have a mechanism in ACUCOBOL-GT that allows you to handle safearray's which this is about.
However, in order to make this work, you would have to know beforehand the exact size of the safearray. Thus, the current implementation of C$GETVARIANT is a bit limited.

Look in ACUCOBOL-GT User's Guide 6.10.2.1 "Passing COBOL data to methods or properties as SAFEARRAYs" for an example.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Variant Datatype

Hi.

I'm having a little problem understanding the provided samples.

Assume that I have a COM object that returns a variant data type - that is a 2 demi-array - with 3 columns and 4 rows - each element with 50 characters of text data.

Could you cut n'paste the code into this message thread to handle this data.

? How to create the COBOL variables and how to assign the returned data into this/these variable(s). Nothing fancy just a straightforward example.

Many Thanks

Brent
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Variant Datatype

Originally posted by BrentM
Hi.

Could you cut n'paste the code into this message thread to handle this data.



Sure, only problem is that my laptop is currently at the "hospital". I have a small demo that illustrates how to use a two dimensional safearray with Excel. But really, it doesn't do much more than the example I referred to you.

What exactly is it you find difficult to understand?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Variant Datatype

Is it possible to have a example - not an excel example - on how you would create the array and how to assign the returned variant data type to it?

Nothing fancy just a few lines of code here? If that is not possbole thanks for your time and pointing me to the manual locations.


Thanks

Brent
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Variant Datatype

Originally posted by BrentM
Nothing fancy just a few lines of code here?


This is not about Excel or not. But you got to put things in context.

Anyway:


01  My2DTable.
      03 FILLER         OCCURS 5.
           05 MyItem   USAGE HANDLE OF VARIANT OCCURS 5.
...
PROCEDURE DIVISION
CALL "C$SETVARIANT" USING
         "Data may be number or string"
         MyItem(1, 1) | Set element 1, 1
         END-CALL.

CALL "C$SETVARIANT" USING
         1234
         MyItem(1, 2) | Set element 1, 2
         END-CALL.

MODIFY MyObject InputData = My2DTable.
INQUIRE MyObject InputData IN My2DTable.


And so on.

Note: When you receive a safearray from a control, it MUST be the same size as yours is defined in WORKING-STORAGE.
0 Likes
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.