Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling RM Cobol from VB

Status
Not open for further replies.

hammy

Programmer
Sep 6, 2001
73
GB
I have a VB Application and I call Cobol programs by doing a call using RUNCOBOL "program name".

I have noticed though in references in VB there is mention of "RM/Cobol Runtime 7.0 Type Library".

It seems that I can use this to do an initial call to run a cobol program, however if I then try to run a second program VB crashes.

Can anyone tell me if it is possible to use this Referrence and if so how?

The code I am trying to use is

Dim rmtest As RMCobolApplication

Set rmtest = New RMCobolApplication
rmtest.RunCommand("HELLOWORLD")
Set rmtest = Nothing


Cheers,

Hammy.
 
First, you are attempting to use an undocumented feature of RM/COBOL, so it is caveat coder.

This comes from my colleague who is the authority on things COM when it comes to RM/COBOL:

The problem you are running into is that, while the "set rmtest = Nothing" releases the COM server, Windows doesn't really unload the COBOL server until it's good and ready to do so. Releasing the server just marks it as eligible for unloading. If you immediately turn around and create the application object again, you get the same, stale server.

One possibility is for you to call CoFreeUnusedLibraries() between creations. This works well from MFC but unfortunately, it doesn't seem to work reliably from VB and the behavior even varies between versions of Windows.

In any case, this is fixed in version 7.5.


RM/COBOL v7.5 for Windows is shipping now. Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top