Rocket® Enterprise Developer (formerly a product of Micro Focus or formerly a product of Open Text) documentation, created before Rocket Software acquired certain products from OpenText, may include outdated references to "Micro Focus" or "OpenText", both of which are trademarks of OpenText or its affiliates. Rocket Software is not affiliated with Micro Focus or OpenText and has since rebranded these products as Rocket® products. You may also encounter outdated links in this documentation. If you do, please contact Rocket Support (support@rocketsoftware.com) for assistance.
cobcall
Calls a COBOL program, subprogram or entry point from C.
Restriction:
This function is supported for native COBOL only.
Syntax:
#include "cobcall.h"
cobrtncode_t cobcall (const cobchar_t *name, int argc,
cobchar_t **argv);
Parameters:
| 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 |
Equivalent COBOL Syntax:
call "name" [using ...] [returning ...]
Example:
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.