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


#include "cobmain.h"

int cobtidy (void);




This function deinitializes the COBOL environment, emptying buffers, closing files and freeing any data areas allocated by the COBOL system.

Use this function if you want to close down the COBOL system, but are not yet ready to exit.  It returns 0 on success.

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

You can call this function 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(), the results are undefined.

Equivalent COBOL Syntax:



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 */