Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling a COBOL DLL with vba?
Message
General information
Forum:
Visual Basic
Category:
VBA
Miscellaneous
Thread ID:
00521784
Message ID:
00522057
Views:
16
Ok, I am only taking a shot here. I would try to make for instance:
Dim VERS As String * 4 -> Dim VERS As String * 5
Dim FILE_DIR As String * 80 -> Dim FILE_DIR As String * 81
Dim RT_KZ As String * 1 -> Dim RT_KZ As String * 2

This allows VB to terminate the string. Cobal doesn't use nul termination. So maybe this may help. It may also be a waste of time. But it is a very fast test.

BTW: You did manage to resurface lots of bad COBOL memories, consequiently I may have to return to therapy. :)


>Hello all of you!
>I have got a big problem. I try to call a cobol dll with vba (MS Access).
>This cobol program has to get some input parameters and gives some output parameters.
>
>The cobol variables look like this:
>
>01 RRINT.
>05 RRINT-CONTROL.
>10 RRINT-VERS      PIC X(04).
>10 RRINT-FILE_DIR  PIC X(80).
>...
>
>05 RRINT-INPARAMS.
>10 RRINT-RT_KZ     PIC X(01).
>10 RRINT-WKZ       PIC 9(03).
>...
>
>05 RRINT-OUTPARAMS.
>10 RRINT-RKL_HAFT  PIC X(03).
>...
>
>10 RRINT-RKL_GEBRL_TAB.
>    20 RRINT-GEBIETSREFORML-ITEM OCCURS 30.
>    25 RRINT-RKL_GEBRL_PLZ        PIC 9(05).
>...
>
>
>my declaration in VBA looks (e.g.) like this:
>
>Declare Function COBOLFUNCTION Lib "cobol.DLL" (ByVal VERS As String, ByVal FILE_DIR As String, ByVal RT_KZ As String, ByVal WKZ As String,ByRef RKL_HAFT As String, ByRef RKL_GEBRL_PLZ As String)
>
>Dim VERS As String * 4
>Dim FILE_DIR As String * 80
>Dim RT_KZ As String * 1
>...
>
>Now everytime I try to call the dll (with Call COBOLFUNCTION(params...)) I encounter a memory violation and the program closes.
>
>I tried it several ways. (Different sequences and so on)
>I searched the Internet (Microsoft Knowledge Base, other sites) but I found nothing that could help me.
>
>I instantly hope that you can help me.
>
>Many thanks in advance
>Judith
~Joe Johnston USA

"If ye love wealth better than liberty, the tranquility of servitude better than the animated contest of freedom, go home from us in peace. We ask not your counsel or arms. Crouch down and lick the hands which feed you. May your chains set lightly upon you, and may posterity forget that ye were our countrymen."
~Samuel Adams

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform