COBOL Manual for TNS and TNS/R Programs

Calling Other Programs and Routines
HP COBOL Manual for TNS and TNS/R Programs522555-006
23-2
Run-Time Environment
Run-Time Environment
Native programs (compiled with the NMCOBOL compiler) always run in the CRE.
Programs compiled with the COBOL85 compiler can run in either the CRE or the non-
CRE (COBOL-specific) environment.
The non-CRE environment is the default for nonnative HP COBOL programs, but with
the compiler directive ENV COMMON, you can request the CRE instead.
HP COBOL programs running in the non-CRE environment can call non-COBOL
routines, but the non-COBOL routines run in the unique run-time environments defined
by their respective run-time libraries. These language-specific run-time environments
are often incompatible with each other, because each language’s run-time library is
unaware of other run-time libraries. This incompatibility severely limits the potential for
creating useful mixed-language programs. In the non-CRE environment, the non-
COBOL routines that your HP COBOL program calls have limited access to their run-
time libraries.
In the CRE, each routine in the program appears to be running in its own language-
specific run-time environment, regardless of the language of the main routine. For
example, if the main routine of a mixed-language program is written in HP COBOL, an
HP C routine still has complete access to the HP C run-time library.
All routines in a program must be compiled to run in the same environment (either their
own language-specific run-time environment or the CRE). Table 23-2 lists the run-time
environments available for the TNS version of each language. All native languages run
only in the CRE.
The CRE library, a collection of routines that implements the CRE, enables the
language-specific run-time libraries to coexist peacefully with each other. User routines
and run-time libraries call CRE library routines to access shared resources managed
by the CRE, such as the standard files (input, output, and log) and the user heap,
regardless of language.
The CRE does not support all possible operations. For example, the CRE supports file
sharing only for the three standard files: standard input, standard output, and standard
log. The language-specific run-time libraries access all other files by calling run-time
procedures directly, whether or not a program uses the CRE.
Table 23-2. Run-Time Environments for TNS Languages
TNS Language Environments Available
HP C CRE
HP COBOL CRE or HP COBOL run-time environment
FORTRAN CRE or FORTRAN run-time environment
Pascal CRE
TAL CRE or TAL run-time environment