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!

Migration from OS/2 to Win/2K with VA Cobol

Status
Not open for further replies.

bithh

IS-IT--Management
Jun 11, 2003
2
DE
Hi,
The VisualAge Cobol program used OS/2 APIs to load DLLs and unload them after use. Unfortunately the VA Cobol on the Windows platform does not have similar DLLs in the package. I am including an extract from a program to give you an idea of how it worked in the OS/2 environment. Does anyone have any idea how this "loadComponent" could be replaced by a Windows API call ?

Load-DivComp.
* Inv2P-P (Pointer) is of no consequence here.
SET Inv2P-P TO ADDRESS OF Inv2P-Parent
SET InvJLAnm-P TO ADDRESS OF JLAnmDef
*
MOVE 8 TO ParentComponent-Length
* Name of 'ParentComponent-String' and Length
* Attention !! Name INVPERS1 should not be changed,
* ---------- as it is referred to in the called Component for using 'connect to Database'.

MOVE ApplName TO ParentComponent-String
Inv2P-Parent
MOVE 18 TO Inv2P-Length
CALL "loadComponent" USING ComponentLoad,
Inv2P-POINT,
VDE-RC

IF NOT VDE-RC-OK
MOVE "InvPers1 - loadComponent xxxxxxxx "
TO VDECHK-Anw
MOVE ChildComponent-String(1:8)
TO VDECHK-Anw(26:8)
Perform LoadVDE-CHK
END-IF.
* ---------------------------------------------------------------
* Load Component "VDE-CHK " to show VDE-RC and -reason
*
* ---------------------------------------------------------------
* only VDE-RC from Messages / load Components / Terminate
* were included when the HANDLE-business was being tested
*
* ----------------------------------------------------------------

LoadVDE-CHK.
SET VDECHK-P TO ADDRESS OF VDE-CDef

MOVE VDE-RC TO VDECHK-RC
MOVE 8 TO ParentComponent-Length
* Name of 'ParentComponent-String' and Length
MOVE ApplName TO ParentComponent-String
MOVE ApplName TO VDECHK-Parent
MOVE 7 TO ChildComponent-Length
MOVE "VDE-CHK" TO ChildComponent-String
MOVE 14 TO VDECHK-Length
CALL "loadComponent" USING ComponentLoad,
VDECHK-POINT
VDE-RC.
* here no 'NOT VDE-RC-OK' - query, as that would start a L o o p.
 
bithh -

I'm guessing you replace the "loadComponent" with "LoadLibrary" and "GetProcAddress" Windows API calls. LoadLibrary loads the target dll and GetProcAddress gets the address of the target entry point in the dll.

Regards.

Glenn
 
Glenn,

thanks for your suggestions. "loadComponent" loads the target dll (which it finds in the "ChildComponent-String" and at the same time passed the parameters (pointers and return-codes) to the called program (dll). When the called pgm is finished it in its turn calls "unloadComponent" which then passes control to the calling pgm (=ParentComponent-String) along with the parameters and at the same time unloads the called pgm. Being a mainframe programmer for many years, I have to think differently on the Windows' platform to find a viable solution to this problem.
Regards

bithh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top