Determining the main routine
In Language Environment, only one routine can be the main routine; no other routine in the enclave can use syntax that indicates it is main. If you write the main routine in C++, you must use language syntax to identify the routine as the main routine. If you use COBOL as the first program in the enclave that is to gain control, the program is effectively designated main by being the first to run.
Table 1 describes how C++ and COBOL identify the main routine.
Language | When determined | Explanation |
---|---|---|
C++ | Compile time | Determined in the C++ source file by declaring a C++ function named main. |
COBOL | Run time | Determined dynamically. If it is the first program to run, it is a main program. |
An entry point is defined for each supported HLL. Table 2 identifies the desired entry point. The table assumes that your code has been compiled using the Language Environment-conforming compilers.
HLL | Main entry point | Fetched entry point |
---|---|---|
C++ | CEESTART | Entry point specified as #pragma fetchable, or explicitly named during link-edit |
COBOL | Name of the first object program to get control in the object module | Program name |
COBOL and C++ routines that make up an ILC application are executed together in a single run unit (the equivalent of a Language Environment enclave). However, unlike in earlier versions of COBOL (VS COBOL II and OS/VS COBOL), the first COBOL program in a run unit is no longer necessarily considered the main routine. If the first COBOL program is not the first routine in the enclave to run, it is considered a subroutine in the Language Environment enclave.