#include "cobcall.h" cobrtncode_t cobcall (const cobchar_t *name, int argc, cobchar_t **argv);
name | A null-terminated string that specifies the name of the COBOL program to be called |
argc | The number of arguments passed in argv |
argv | Arguments to be passed to the COBOL program |
call "name" [using ...] [returning ...]
To call a COBOL entry point cobep with two string arguments from a C function, use either:
cobchar_t *argv[2]; argv[0] = arg1; argv[1] = arg2; cobcall("cobep", 2, argv);
or:
cobep(arg1, arg2);
Comments:
This function is used to call the COBOL program of the specified name using the arguments passed in argv. Parameters are passed BY REFERENCE.
The result of a cobcall() is a COBOL type call as defined in the ANSI '74 standard and behaves in the same way as if the COBOL entry point had been called from COBOL.
Using this function is equivalent to calling a COBOL program directly from C code, using C syntax.
If the specified name is an entry point of an already loaded COBOL program, that program is called. Alternatively, if the specified name is a C function, then that is called. Otherwise, a program with a basename of the specified name is searched for on disk using the following search order:
If no program of the specified name can be found a run-time error is produced.
If the COBOL entry point does not expect any arguments then argc should be 0 and argv should be NULL.