Skip to main content

problema calling .NET from COBOL

  • January 23, 2012
  • 2 replies
  • 0 views

[Migrated content. Thread originally posted on 22 January 2012]

Hi,
I'm doing a program that interface a .NET dll with 9.0.0 runtime.
I have included my .NET assembly in my COBOL programs and created the file .DEF
with NETDEFGEN utility. Then I used the following "CREATE" statement to create a new instance:

create "@ePrescription"
NAMESPACE is "ePrescription"
CLASS-NAME is "ePrescription"
CONSTRUCTOR is @CONSTRUCTOR1()
HANDLE is eprescr-handle
FILE-PATH is "bin\\eprescr.xml".

I used FILE-PATH because the assembly does not reside in the GAC and is not in same directory as "wrun32.exe".
The runtime is in "D:\\wfar\\bin" directory.
The assembly is in "D:\\wfar\\bin\\ePrescription" directory.
The "CREATE" statement successful, but "MODIFY" of first method goes in exception with the following message:

Unable to load file or assembly "ePrescriptionCore, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=null"
or one of its dependencies... unable to find the file specified.

If I put all DLL in the same directory as "wrun32.exe" working properly.
If I put all DLL in the "ePrescription" directory the program goes in exception, although the FILE-PATH was specified.

Any help here would be great.
Valerio

2 replies

Stephen Hjerpe
  • Participating Frequently
  • 1100 replies
  • January 23, 2012

[Migrated content. Thread originally posted on 22 January 2012]

Hi,
I'm doing a program that interface a .NET dll with 9.0.0 runtime.
I have included my .NET assembly in my COBOL programs and created the file .DEF
with NETDEFGEN utility. Then I used the following "CREATE" statement to create a new instance:

create "@ePrescription"
NAMESPACE is "ePrescription"
CLASS-NAME is "ePrescription"
CONSTRUCTOR is @CONSTRUCTOR1()
HANDLE is eprescr-handle
FILE-PATH is "bin\\eprescr.xml".

I used FILE-PATH because the assembly does not reside in the GAC and is not in same directory as "wrun32.exe".
The runtime is in "D:\\wfar\\bin" directory.
The assembly is in "D:\\wfar\\bin\\ePrescription" directory.
The "CREATE" statement successful, but "MODIFY" of first method goes in exception with the following message:

Unable to load file or assembly "ePrescriptionCore, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=null"
or one of its dependencies... unable to find the file specified.

If I put all DLL in the same directory as "wrun32.exe" working properly.
If I put all DLL in the "ePrescription" directory the program goes in exception, although the FILE-PATH was specified.

Any help here would be great.
Valerio
Yes, having the assemply not in the GAC or in the runtime directory is challenging. I believe you also need to make an entry in a text file called Netevents.ini

C:\\Program Files\\Micro Focus\\Acucbl901\\AcuGT\\sample\\dotnet\\NETOBJECTS\\ReadMeSetup.txt

  • Author
  • Rocketeer
  • 19312 replies
  • January 24, 2012

[Migrated content. Thread originally posted on 22 January 2012]

Hi,
I'm doing a program that interface a .NET dll with 9.0.0 runtime.
I have included my .NET assembly in my COBOL programs and created the file .DEF
with NETDEFGEN utility. Then I used the following "CREATE" statement to create a new instance:

create "@ePrescription"
NAMESPACE is "ePrescription"
CLASS-NAME is "ePrescription"
CONSTRUCTOR is @CONSTRUCTOR1()
HANDLE is eprescr-handle
FILE-PATH is "bin\\eprescr.xml".

I used FILE-PATH because the assembly does not reside in the GAC and is not in same directory as "wrun32.exe".
The runtime is in "D:\\wfar\\bin" directory.
The assembly is in "D:\\wfar\\bin\\ePrescription" directory.
The "CREATE" statement successful, but "MODIFY" of first method goes in exception with the following message:

Unable to load file or assembly "ePrescriptionCore, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=null"
or one of its dependencies... unable to find the file specified.

If I put all DLL in the same directory as "wrun32.exe" working properly.
If I put all DLL in the "ePrescription" directory the program goes in exception, although the FILE-PATH was specified.

Any help here would be great.
Valerio
News!
If I change the name of the directory from "ePrescription" to "ePrescr" working properly!!!
I suspect there are problems with NAMESPACE or CLASS-NAME or DLL NAME... if equal to the name of directory goes in exception.
However, I'll try try with Netevents.ini...
thanks shjerpe