Highlighted
Absent Member.
Absent Member.
953 views

[archive] Calling Cobol from .NET

[Migrated content. Thread originally posted on 03 March 2009]

Hey guys, I'm trying to figure out how to call cobol from .NET using the .NET Interface Assembly, "wrunnet.dll".
I can't seem to find any example in the AcuGT documentation.
Just to experiment:

IDENTIFICATION DIVISION.
PROGRAM-ID. AcuAddNumbers.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 number1 pic s9(9) comp-5.
01 number2 pic s9(9) comp-5.
01 number3 pic s9(9) comp-5.
PROCEDURE DIVISION USING number1, number2, number3.
PRINTSCREEN-MAIN-PARA.
compute number3 = number1 + number2.
EXIT PROGRAM.

compiled it with "ccbl32 --netdll:2.0" option.

it created "AcuAddNumbers.dll, AcuAddNumbers_CVM.dll, AcuAddNumbers.acu"

Now when I try to run a VB.NET program to use the AcuAddNumber,
I'm getting: "Could not load file or assembly 'wrunnet, Version=8.1.0.0, Culture=neutral, PublicKeyToken=9045b74f3449b506' or one of its dependencies. An attempt was made to load a program with an incorrect format." error message. Can anyone tell me what the problem is or post an example of calling the cobol program. Thanks in advance.

AcuGT Extend 8.1, Visual Studio 2005
0 Likes
3 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling Cobol from .NET

There is a sample program in C:\Program Files\Acucorp\Acucbl810\AcuGT\sample\wrunnetutil

Regards,
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling Cobol from .NET

Even with the example in the directory, I'm getting "Could not load file or assembly 'wrunnet, Version=8.1.0.0, Culture=neutral, PublicKeyToken=9045b74f3449b506' or one of its dependencies. An attempt was made to load a program with an incorrect format." error message. If you guys are not getting this error message, it must be my configuration. Anything I need to look out for?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling Cobol from .NET

Now that I look at this again I believe this is the same as the Support Incident I'm working on with you. If you are on a 64-bit system with 64-bit Visual Studio you might need to modify your VS project settings, build tab, to select "x86" for the platform target.

Are you in fact on 64-bit? Have you tried that setting?

Go ahead and reply in the Support Incident so it is updated properly.

Thank you,
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.