CRE Programmer's Guide

CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide528146-004
2-17
Sharing Standard Files
If CRE_Terminator_ cannot close a standard file, it writes an error to standard log.
If it cannot write to standard log, CRE_Terminator_ uses a generic completion error
value for the status code and reports the text “Close error on IN”, “Close error on
OUT”, or “Close error on log” according to which standard file it cannot close.
If one of the values supplied as a parameter that CRE_Terminator_ passes on to
PROCESS_STOP_ is rejected, CRE_Terminator_ invokes PROCESS_STOP_,
specifying ABEND and the text “Invalid termination parameter.”
When the CRE completes its termination logic, it returns a status code to the process
that created your process, typically the TACL command interpreter. The status code
specifies the reason your process terminated. See CRE_Terminator_ on page 6-42 for
more details on CRE termination and termination codes.
Sharing Standard Files
The C, COBOL, and FORTRAN languages provide a predefined input file—called
“standard input”—and a predefined output file—called “standard output”. Your program
can use standard input and standard output without having to write extensive code to
define, open, or manage them. For most languages, a third file—“standard log”—is
also predefined. (FORTRAN does not support unit connection to standard log except
for messages specified in FORTRAN PAUSE and STOP statements.)
The CRE enables a program to share the standard files—standard input, standard
output, and standard log—with routines written in more than one language. With the
CRE, shared standard files accessed from routines written in different languages
behave the same as if they were unshared and accessed from only one language.
In the Guardian environment, the CRE performs the tasks described in this subsection.
In the OSS environment, the CRE does not support standard files because the OSS
file system provides this feature.
Sharing Standard Files Without Using the CRE
For programs that do not run in the CRE, I/O requests to standard input, standard
output, and standard log are processed by the language-specific run-time library for the
requesting routine. The run-time library sends requests for system services directly to
the HP NonStop operating system. Running mixed-language programs without the
CRE is limited because of incompatibilities between run-time libraries.
For example, if you have routines written in C, COBOL, and TAL, requests to write to
standard output from C routines are processed by the C run-time library, requests from
COBOL routines are processed by the COBOL run-time library, and requests from TAL
routines must be sent by the routines directly to the operating system. Because the
three routines cannot share the same operating system file open, each establishes a
separate operating system open to the file. If routines in each of the three languages
open and write to the same disk file, data from each of the three run-time libraries
Note. TNS environment language modules cannot share with native language modules.