Skip to main content

[archive] Calling Cobol from .NET

  • March 16, 2009
  • 3 replies
  • 0 views

[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

3 replies

[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
There is a sample program in C:\\Program Files\\Acucorp\\Acucbl810\\AcuGT\\sample\\wrunnetutil

Regards,

[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
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?

[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
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,