cobtidy

Tidies up the global COBOL run-time environment.
Restriction: This function is supported for native COBOL only.

Syntax:

#include "cobmain.h"

int cobtidy (void);

Parameters:

None.

Comments:

Use this function if you want to close down the COBOL system, but are not yet ready to exit.  It returns 0 on success. It deinitializes the COBOL environment, emptying buffers, closing files and freeing any data areas allocated by the COBOL system.

Do not call cobtidy() directly from a COBOL program.

You can call it only when all COBOL modules have been exited, and you do not intend to re-enter them. If you do call any COBOL entry points or COBOL routines (such as cobinit()) after you have called cobtidy(), a COBRT090 Re-initialization of Run-Time System not supported (Fatal) error is generated.

This function causes undefined behavior when called by a process that was invoked using cobrun, or which began by running an executable that was linked using cob -x.

Equivalent COBOL Syntax:

None.

Example:

The following example shows how to initialise 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);
}