cobinit

Initializes the COBOL environment, so that a COBOL program can be called from a non-COBOL program.
Restriction: This function is supported for native COBOL only.

Syntax:

#include "cobmain.h"

int cobinit (void);

Parameters:

None.

Comments:

You must call cobinit() before calling a COBOL program if the main program is not written in COBOL.

If you do not, you might receive an initialization error when you enter your COBOL code.

On some platforms, the COBOL environment is initialized when the COBOL run-time system is loaded (for example, at process startup).

If the COBOL environment has already been initialized then cobinit() returns successfully.

This function returns 0 on success.

Equivalent COBOL Syntax:

None.

Example:

The following example shows how to initialize (and close down) the COBOL environment from a C main(), so that a COBOL program can be called:

main(int argv, char *argv)
{
    cobinit();             /* Initialize COBOL environment */

    cobcall("cobep", 0, NULL); /* Call a COBOL program */

    cobtidy();             /* Close down COBOL environment */

    return(0);
)