Starting a Program with C$SYSTEM

Another way to invoke a C program from COBOL is via the operating system command line using the C$SYSTEM library routine. This routine combines the functionality of SYSTEM and C$RUN.

To call a C program from COBOL via C$SYSTEM, you:

  1. Call the C$SYSTEM library routine. The C$SYSTEM routine submits the command line to the host operating system as if it were a command keyed in from the terminal.

    Note that you can call C$RUN instead of C$SYSTEM to run the command asynchronously.

  2. Pass data from the C program to the COBOL program through a disk file or database.

C$SYSTEM and C$RUN for complete information on these library routines.