Simple Use Case for acu_cobol()

The following example demonstrates a call to the acu_cobol() C function:

int 
main(int argc, char *argv[]) 
{
char *initv[3]; 
struct a_cobol_info cblinfo; 
initv[0] = argv[0]; 
initv[1] = "-c"; 
initv[2] = "myconfig"; 
acu_initv(3, initv);
memset(&cblinfo, 0, sizeof(cblinfo)); 
cblinfo.a_cobol_info_size = sizeof(cblinfo); 
cblinfo.pgm_name = "MYCBLPGM"; 
acu_cobol(&cblinfo); 
acu_shutdown(1);
return 0;
} 
This is equivalent to running a program from the command line as:
runcbl -c myconfig "MYCBLPGM" 

If you add the no_stop parameter to the a_cobol_info structure, the COBOL program returns to the caller if the program executes a STOP RUN:

struct a_cobol_info cblinfo; 

memset(&cblinfo, 0, sizeof(cblinfo));
cblinfo.a_cobol_info_size = sizeof(cblinfo);
cblinfo.pgm_name = "MYCBLPGM"; 
cblinfo.no_stop = 1; 
acu_cobol(&cblinfo); 

Otherwise, you can remove the no_stop parameter and force the executable to halt:

struct a_cobol_info cblinfo; 

memset(&cblinfo, 0, sizeof(cblinfo)); 
cblinfo.a_cobol_info_size = sizeof(cblinfo); 
cblinfo.pgm_name = "MYCBLPGM"; 
acu_cobol(&cblinfo);