Dynamic Linking in COBOL

I have two modules called 'A' and 'B'. Module 'A' opens the ORACLE database connection, and Calls 'B', which queries the database using the 'SELECT' statement.

When I hard code the module name during CALL, the called module uses the database connection opened in the module 'A'. Pls refer below:

CALL "B"

But, when I moved the module name into a variable and try to call the module, as below

MOVE "B" TO VAR-MODULE-NAME
CALL VAR-MODULE-NAME.

the called module is not using the database connection, which results in an error "ORA-01012 - Not Logged On".

And both the modules are compiled as follows:
cob2 B.cbl -o B -L
cob2 A.cbl -o A -L or cob2 A.cbl B.cbl A -L

Can anyone answer my query? Also, can anyone answer that some compiler options needs to be modified?

Questions by mohanaraj_j

Showing Answers 1 - 3 of 3 Answers

Sharad

  • Feb 9th, 2016
 

This problem can be resolved by compiling the main program (Calling program) using the DYNAM compiler option

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions