Calls a COBOL program, subprogram or entry point and then cancels it.
Restriction: This function is supported for native COBOL only.


#include "cobcall.h"

cobrtncode_t cobfunc (const cobchar_t *name, int argc, 
                     cobchar_t **argv);


name A null-terminated string that specifies the name of the COBOL program 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 has the same effect as specifying cobcall() and then cobcancel().  That is, it calls the specified program and then cancels it, leaving the data contained in the program in its initial state. See the descriptions of cobcall() and cobcancel() for more details.

This function, unlike cobcall(), causes the program to behave as if it had been called using C function rules rather than COBOL call rules. cobfunc() returns the return code of the called program.

Equivalent COBOL Syntax:

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


To call and then cancel a COBOL entry point cobep which takes no arguments use:

cobfunc("cobep", 0, NULL);