| Re: .0
Your COBOL routines should probably be in compiled form and then either
linked with your main C program or linked into a shareable image which
your main C program can 'activate' by using lib$find_image_symbol().
Have you read any of the following threads in this conference? ..
Topic Author Date Repl Title
--------------------------------------------------------------------------------
5605 MSAM03::FOOSZEMUN 9-APR-1997 0 Cobol in C Program
5489 MLAVAX::SHEKER 3-FEB-1995 2 Cobol, C, Stuctures, problems
5300 SWAM1::EDWARDS_RI 21-FEB-1994 2 Calling COBOL from C
5175 BUMP::EUSSUPPORT 7-SEP-1993 3 reading a COBOL file in C program
5167 SNOFS1::GERAGHTY 26-AUG-1993 2 COBOL, BASIC and C/C++ as development languages?
4874 WHODA2::GTRUTT 13-JAN-1993 1 fopen and cobol crashes
4857 SOLVIT::SILVA 30-DEC-1992 3 COBOl to C converter?
4542 ESOA11::ABRAMS 24-JUN-1992 4 How to emulate COBOL "SIGN IS TRAILING" in C?
4307 CANYON::CONROY 5-MAR-1992 3 COBOL level 88 to C data structure?
3733 HXOU01::VEY 27-MAY-1991 17 VAX C calling COBOL?
3375 TRCA03::KAMINSKI 12-DEC-1990 5 COBOL, C and RMS Segmented Keys
3093 PDV01::MEDONI 17-AUG-1990 0 COBOL to C translator WANTED
3084 COMICS::FLANDERSD 14-AUG-1990 3 Speed comparison C vs. COBOL images
2845 TADSKI::STOCKDALE 25-APR-1990 2 Comp-3 field created in Cobol read by C pgm.
2675 IJSAPL::BOUWMANS 16-FEB-1990 0 Problems calling C from COBOL
2629 ALLVAX::LUBY 29-JAN-1990 7 Problems calling VAXC from COBOL
2023 DNEAST::COMBAR_CURT 10-APR-1989 9 VAXC vs. BASIC, COBOL
939 KLOV04::DECSTR 9-SEP-1987 1 Cobol calling C.
889 NRPUR::CHABOT 6-AUG-1987 11 Calling C routines from COBOL
John.
|
|
See the _OpenVMS Programming Concepts_ manual, please.
: I've a simple question to ask since I'm not a programmer.
Oh. It's a simple question _because_ you're not a programmer? :-)
(Isn't English fun? :-)
: My question is "How to run/call a Cobol program in a C program?"
If you want to "chain" to another program, use lib$do_command().
The first image exits, and the second starts up, in the
same process.
This involves two images activated sequentially in a
single process.
If you want to "invoke" another program either synchronous to
the main image or asynchronous to the main image, use the
lib$spawn() or sys$creprc() calls, or language-specific
calls such as C's system().
This involves an image in one process starting up an
image in another detached process or subprocess, and
then immediately (asynch call) or when the other
image completes (synch calls).
If you want to "merge" one image (a "shareable image") directly
into another shareable image or executable image, then you
use the RTL call lib$find_image_symbol().
This involves adding more executable code to an already
running image. All activity takes place in the same
process...
If you want to perform mixed-language programming, this is
fully supported by the OpenVMS "calling standard", by
DIGITAL compilers, and by the OpenVMS LINKER utility.
See the OpenVMS Calling Standard, and the Guide to
Modular Programming.
: Must the Cobol program in execution format?
Executable code is stored in an "image file", and there are
several different types of "images":
"executable" (these are standard images that folks can
directly RUN or can invoke via a DCL command),
"shareable" (these are code libraries, and can only be
executed as a constitent of an executable image),
"system" (you don't need to know about these right
now",
and "user written system services" (these are sometimes
called "privileged shareable images"; these are images
that include special dispatching code, and that are
designed and intended to operate in executive-mode or
kernel-mode. You don't need to know about these yet.)...
|