Calling a COBOL Entry Point Directly

The following instructions are considered good programming practice. References to COBOL entry points in this topic include both the PROCEDURE DIVISION header and ENTRY statements.

When calling a COBOL entry point directly from C (as opposed to using cobcall() or cobfunc()), and passing fewer parameters than are specified on the entry point (that is, fewer actual parameters than formal parameters) then the COBOL entry point called from C should be declared in the C program with a function prototype with a variadic parameter list (see below).

Example

Take a COBOL program with the following entry points defined:

 entry "bob" using arg1 arg2 arg3 arg4 arg5 arg6
 arg7 arg8 arg9.

and a C program that contains code such as:

 i = bob(&x1, &x2);

then the correct way to declare this COBOL entry point in the C program is as follows:

 int bob(void *arg1, void *arg2,...);