COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
18 HP COBOL CRE Support
All native programs run in the CRE. Native HP COBOL programs can call and be called by programs
written in native HP C, native HP C++, and pTAL, even if the main program is not written in HP
COBOL.
For more information about writing HP COBOL programs for the CRE, see the CRE Programmer’s
Guide.
Introducing the CRE
The Common Run-Time Environment (CRE) is a set of services that supports mixed-language
programs. The CRE library is a collection of routines that implements the CRE. The CRE library
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 operating environment procedures directly, whether
or not a program uses 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 has complete access to the HP C run-time library.
Refer to the CRE Programmer’s Guide for more information on writing programs that use the services
provided by the CRE.
Shared File Operations
A CRE HP COBOL program shares certain file operations with other programs in its run unit. The
shared file operations are associated with these files. Other file operations are not shared.
• Standard Output File
For DISPLAY statements, it is the default file (no UPON phrase is specified).
• Standard Input File
For ACCEPT statements, it is the default file (no FROM phrase is specified). This file can be a
disk file, including an EDIT file.
• Execution Log File
The HP COBOL run-time diagnostic messages are written to this file. It is normally the home
terminal, but can be selected by PARAM EXECUTION-LOG.
• $RECEIVE File
It is specified in the RECEIVE-CONTROL paragraph or by a TACL ASSIGN command.
Any program in the run unit can read from or write to the preceding files and there is only one
shared file connector. In the case of the $RECEIVE File, HP COBOL has high-level interface to it,
but programs written in other languages must make special calls to CRE routines to share it. In the
case of the other files listed previously, sharing is done by concurrent opens of the file.
Arithmetic Overflow Processing
When an arithmetic overflow condition occurs that is not covered by ON SIZE ERROR, the CRE
traps the error. Then, if the program specifies PARAM INSPECT ON, the CRE causes the program
to enter the selected debugger (see Debugger Selection). If the program specifies PARAM INSPECT
Introducing the CRE 709










