Highlighted
Absent Member.
Absent Member.
2565 views

[archive] Calling VB and passing data

[Migrated content. Thread originally posted on 02 November 2003]

We are attempting to interface our Acucobol product with Crystal Reports and someone has created a Visual Basic application to accomplish the interface. We can call the Crystal Viewer and display it ok, but we are having a problem passing parameters to and from a VB program, and neither of us knows why. The VB program is supposed to fill a table that we pass it, but when we pass it the empty table...it comes back empty.
Attached is the VB program that we pass the one-dimensional table to, along with the Acucobol program that calls it and attempts read the table after the VB program fills it. Can anyone tell us what we are doing wrong? We don't have much previous experience with ActiveX/OLE programming.

In the VB program, the first character of each entry indicates the parameter type (Distinct, multiple, range), followed by the parameter name. We would append a '/' followed by each value, then the VB program can break it apart and process the parameters. It returns an integer that defines the length of the table.
0 Likes
9 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

Before I look at your use of the VB application here, I would like to ask you a question:

Why in the world do you go via VB? Why don't you use Crystal Reports directly from ACUCOBOL-GT?

It is very straight forward, here is a source example:

display standard graphical window
lines 30
size 80
title "brics 2000 crystal reports"
background-low
handle in myhandle.
display crystalreport line 2
column 5
size 80
lines 20
visible 0
handle in crystal-1.
modify crystal-1 reportfilename = "your.rpt".
modify crystal-1 destination = crpttowindow.
modify crystal-1 action = 1.
modify myhandle action = 20. | minimize
accept omitted.
destroy crystal-1.
exit program.

Gisle
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

The main reason to go with VB is that we want to provide some standard reports to our clients written in Crystal, and then give them the flexibility to modify them according to their needs (add a field, take one away), or to create their own. Most or all of these reports would require the user to enter multiple prompts in order to select the data for the report. It is an administrative software package for colleges and universities, so they need to see such things as what students are registered for specific terms, who registered for less than 12 hours, ad infinatum...
So our intent is to have the user click a button on the Cobol screen, bring up a list of reports that we (or they) have written, choose one, and then tell the VB program what report they chose and supply it a table. The VB program would then query the report, and return to us a table of parameters that may need to be filled to generate a usable report. We would throw up a screen for the user to fill with answers, and pass them back to the VB program which would generate the report. Then let them display it in the Crystal viewer so they can print, zoom, search, etc...the report.
We are long time Cobol programmers (since 1964?), and are extremely happy about the tools Acucorp has supplied us with to make our product better than ever, but we didn't see any way to accomplish this with Cobol
A lengthy answer I know, but thanks for taking the time Gisle. Or anyone else who may read it and respond with an opinion."
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

I am surprised by your answer, because I cannot see anything in your list of reasons that you cannot as well accomplish with elegance in ACUCOBOL-GT. You have the precise same integration with Crystal Reports there as you have it from Visual Basic. Be it dynamic report loading, preview, scaling, zooming, you name it.

So, why you want to bug yourself maintaining double languages is beyond my comprehension.

I am not that familiar with making ActiveX in Visual Basic, and the provided source is incomplete.

Are you aware that you have to use c$setvariant and c$getvariant to respectively set and get variant data?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

Are you perhaps using the Crystal Report Builder? Is this what you mean by allowing users to change the report: take fields away, add fields?
If so, you should still be able to use this as an ActiveX component with Acucobol. If you tried this and it does not work well, then I can understand your use of VB.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

Maybe I shouldn't have mentioned the Crystal viewer....it seems to have taken the thread in a different direction. It is merely an afterthought. The key component we are trying to do is build an interface with Crystal Reports to allow us to query the report we designed and find what info is needed to run the report, put a screen up to allow the user to input that information, and generate the report. All without ever leaving the Acucobol application (seamless, so to speak). As a long time (10 years?) user of Acucobol, we could not find any way in the documentation to do that, which forced us to an outside party to write it in VB. If someone could point us to where in the documentation we could begin writing the interface in Acucobol, it would be much easier for us and much appreciated. Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

To DanM...I'm not sure what you are referring to by the Crystal Reports builder.

We thought we would see if we could allow the user some limited capabilities through parameters built into the report. Or do you mean the Report Design Component? We haven't investigated using that yet.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

Section 6.10 of the acucobol-gt users manual covers activex/com controls.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

Ok...that should be enough to get us going. Since it is no longer a "Language Interoperability" issue with VB, I'll post any problems, questions, and successes to the ActiveX forum, where it would be more appropriate. Thanks to DanM and Gisle for the help!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling VB and passing data

RSoftCheck,

We use many VB "programs" and have no problem passing data to/from them.

I don't know exactly what you guys are doing; however, if you are calling an EXE, you can pass a parameters to a VB program by 'CALL "C$RUN" USING vbprogram GIVING parameter'. Of course, this will create an independant VB run unit on the system. And then, you can create an "acucobol dll" where VB Exes can call the COBOL DLLs which they can retrieve data for VB programs.

The another method, which we like the best, is to write VB dlls where it can be "called" like cobol sub-routines, which will give you the most flexiblity and control.
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.