Using 32-bit ACUCOBOL 9.2.1 in Windows 7, I get the following error when executing a MODIFY statement:
---------------------------
Error
---------------------------
Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))
COBOL error at 00002C in MyCOBOL.acu
("MyCOBOL.cbl", line 22)
---------------------------
OK
---------------------------
The MODIFY statement is:
MODIFY WS-NONGUI-HANDLE "getInt"() GIVING WS-INT
The complete COBOL code is:
IDENTIFICATION DIVISION.
PROGRAM-ID. TESTPROG.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SPECIAL-NAMES.
COPY "MyDLL.def".
.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NONGUI-HANDLE HANDLE OF "@MyDll.MyNamespace.MyClass".
77 WS-INT PIC 9(5).
PROCEDURE DIVISION.
CREATE "@MyDLL"
NAMESPACE IS "MyNamespace"
CLASS-NAME IS "MyClass"
HANDLE IS WS-NONGUI-HANDLE.
MODIFY WS-NONGUI-HANDLE "getInt"() GIVING WS-INT
DISPLAY "WS-INT: " WS-INT
ACCEPT OMITTED
GOBACK.
I saw in a previous forum post that this error can occur if AcuToNet.dll is not registered. Since I used the .NET 4.0 compiler when building my DLL, I assumed that the relevant utility for registering the DLL is RegAsm40Acu.exe. I therefore ran the following command in the directory containing AcuToNet.dll:
RegAsm40Acu.exe /register /codebase AcuToNet.dll
The result was "Types registered successfully". However, the run time error shown above still occurs when the MODIFY statement is executed.
I then saw in the Reference Manual that AcuToNet.dll is not ordinarily required in ACUCOBOL 9, but can be used by specifying the --a2n runtime option. So I tried that. I then got an error on the CREATE statement, which was:
---------------------------
Error
---------------------------
AcuToNet CoCreateInstance failed: 0x80131417
COBOL error at 00001E in MyCOBOL.acu
("MyCOBOL.cbl", line 16)
---------------------------
OK
---------------------------
The reference manual does adress this error message, but what is says does not seem to apply to ACUCOBOL 9.2.1. Also I have already registered AcuToNet.dll, so perhaps that's not the full answer. Please advise -- and thank you in advance for any help.
#runtimeerror
#ACUCOBOL9.2.1



