I have the need to call a C++ program from a mainframe COBOL II program. Is there anything special that needs to be done ? Any help would be appreciated. [sig][/sig]
I am not familiar with C++ on the mainframe, but with assembler and Pl/1, which are both no problem to call from COBOL II.
Out of a 370 language manual:
| * If you want to call a C/C++ function with a function return value,
| use:
| CALL . . . RETURNING
but that is no valid COBOL II code, so you have to follow the instructions for assembler and in the C++ manual you can look after what to do to let the C++ program behave like an assembler program.
Perhaps you can even find something in the language environment manual.
If you can work with the newer COBOL version, it is easier.
Yes, but it depends on the parameter types. COBOL has most of the types that C has, you just have to match the PIC and USAGE clauses carefully. Most COBOLs even have a POINTER data type these days if you have a need for one. (If you have this capability, it can be set to a location in your program with the SET statement.) Also be aware of the way the arguments should be passed. You can preceed the arguments with BY REFERENCE or BY CONTENT in order to get them passed the right way.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.