Skip to main content

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?

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?

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

 


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

 

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.