Adriana Pereira
Adriana Pereira

Reputation: 17

How do I call another program in Cobol?

I'm developing a system in Cobol using screen section and I can't call a customer registration program when I select an option in the menu that I created in another program. I am using opencobol with GnuCOBOL compiler.

CALL "ANOTHER-PROGRAM"
     USING BY CONTENT SUBMENU-IN-WS
CANCEL "ANOTHER-PROGRAM"

which I get this error:

libcob: module "ANOTHER-PROGRAM" not found.

How do I call another program in Cobol using opencobol? Do I need to use linkage section in the ANOTHER-PROGRAM even than I will not use it?

Upvotes: 2

Views: 1450

Answers (1)

Simon Sobisch
Simon Sobisch

Reputation: 7297

CALL is perfectly fine. You only have to make sure that ANOTHER-PROGRAM is available in COB_LIBRARY_PATH (environment variable, defaults to ".") and that both the dso name (.so / .dll) matches "ANOTHER-PROGRAM" or that this dso was named in COB_PRE_LOAD.

Note: OpenCOBOL will only find it if the original PROGRAM-ID in "ANOTHER-PROGRAM" is named exactly the same (including case).

Upvotes: 6

Related Questions