Calls a COBOL program, subprogram or entry point from C, using a function pointer.
Restriction: This function is supported for native COBOL only.


#include "cobcall.h"

cobrtncode_t cobcallpp (PFR rtn, int argc, 
                      cobchar_t **argv);


var A function pointer to the COBOL program, subprogram or entry point to be called
argc The number of arguments passed in argv
argv Arguments to be passed to the COBOL program


This function is used to call a COBOL program, subprogram or entry point using a function pointer, and using the arguments passed in argv. Parameters are passed BY REFERENCE.

You can initialize rtn either by directly referencing the COBOL entry point if it is linked into the application, or by using cobgetfuncaddr(). In the latter case, the program will be searched for when cobgetfuncaddr() is called, not when cobcallpp() is called.

The result of a cobcallpp() 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.

If the COBOL entry point does not expect any arguments then argc should be 0 and argv should be NULL.

Equivalent COBOL Syntax:

call "name" [using ...] [returning ...]


To call a COBOL entry point cobep with two string arguments from a C function, use either:

PFR rtn = cobgetfuncaddr("cobep");
cobchar_t *argv[2];
argv[0] = arg1;
argv[1] = arg2;
cobcallpp(rtn, 2, argv);


cobep(arg1, arg2);