acu_initv()

The acu_initv() function performs all of the initialization needed to run a COBOL program. This includes loading the COBOL configuration file, initializing the user's station, and initializing each available file system.

Usage

int ASTDCALL acu_initv(int argc, char **argv); 

The acu_initv() function also registers various signal handlers so that the runtime can catch certain signals and perform an orderly shutdown or some other function.

Using acu_abend() with the --no-signal-handlers runtime option allows you to control signal handlers based on the signal type.

For more information on acu_initv(), see Initializing the Runtime.

Parameters

  • argc — the number of arguments passed in argv, at least 1
  • argv — an array of arguments. It must contain at least one argument in argv[0]. This should be a pointer to the name of the executable file, that is, the same as the argv[0] passed to your own main routine.

Note that in some situations, this array of character pointers is needed after acu_initv() returns. Therefore, the variable passed in this parameter must remain in scope until the runtime shuts down. You can accomplish this in one of several ways:

  1. Make argv a static variable in the C function where it is defined.
  2. Make argv a global variable to the C module.
  3. Call the functions, acu_initv(), acu_cobol(), and acu_shutdown() from within a single function of your application (or in subfunctions of the C function that calls acu_initv()).
Note: If you do not keep argv in scope for the duration of the runtime's life, you may experience unwanted results.

No other arguments are required. To pass additional arguments, format them in the same manner as a typical runcbl command line, where arguments to the runtime are followed by the COBOL program name, and then by any arguments to that COBOL program.

Return Values

This function returns the argument number of the COBOL program name in argv (or the value of argc if there isn't one), if there is not a failure and the --xreturn argument is not present in argv. The runtime's own main routine uses this to easily locte the name of the program to load. If there is a failure and --xreturn is present in argv, a negative number is returned indicating the source of the failure. Use the following symbols, defined in sub.h, to interpret the failure code.

AINITV_SUCCESS Sucess
AINITV_LICENSE_EXPIRED License had expired
AINITV_LICENSE_NOT_FOUND License not found
AINITV_LICENSE_EXCEEDED License user count exceeded
AINITV_INIT_LIBRARY_FAILED Library initialization failed
AINITV_LOAD_LIBRARY_FAILED Library load failure
AINITV_CFG_FAILED Configuration error
AINITV_DEBUG_FAILED Debug initialization failed
AINITV_FILE_FAILED File manager initialization failed
AINITV_MEM_FAILED Memory allocation failure
AINITV_RMT_FILE_FAILED Remote file manager initialization failed
AINITV_STARTUP_FAILED Runtime initialization failed
AINITV_PROFILE_FAILED Profile initialization failed
AINITV_MISMATCHED_VERSIONS Mismatched version between runtime and support module
AINITV_EXCEPTION Exception encountered