Highlighted
Valued Contributor.
Valued Contributor.
264 views

Passing data between Visual Basic and COBOL

I have a COBOL program that calls a VB6 program, which reads data from a weight scale using COM port.

The data is saved into a TXT file, then the COBOL program opens the TXT and reads the data.

Everything works fine so far, but is it possible to pass and receive data between the programs directly without creating any file?

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Passing data between Visual Basic and COBOL

It may be possible. It will depend on how you want to expose your VB code. Acu provides capabilities to use COM, so that VB or other programs can call the runtime, passing arguments (data). You could make your VB code into an ActiveX object, use the Acu utility AxDefGen so that the functions and properties are described to the COBOL program, and instead of Call, you would CREATE an instance of your control within COBOL and then INQUIRE on the property that contains the data, now that the INQUIRE is done, that data is now available as COBOL working-storage data item.

https://www.microfocus.com/documentation/extend-acucobol/1011/BKITITDOTNS022.html

 

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: Passing data between Visual Basic and COBOL

Sorry for the late reply. I downloaded a sample from the internet and followed the instructions here (https://www.microfocus.com/documentation/extend-acucobol/925/BKITITACTXS017.html, https://www.microfocus.com/documentation/extend-acucobol/925/BKITITACTXS004.html), but no success.

In COBOL, I tried CREATE and INQUIRE like this:

CREATE clsMath OF DLLMath
SERVER-NAME IS '128.0.0.220'
HANDLE IN clsMath.
INQUIRE clsMath fSum IN WS-TEMP.
DISPLAY WS-TEMP.

What is the correct way to call the function fSum? The .def file is attached for your reference.

 

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.