CRE Programmer's Guide
CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
2-18
Sharing Standard Files Using the CRE
might write to the same disk location because there is no method for the run-time 
libraries to share the file record pointer. That is, because each routine begins writing at 
the beginning of the same file, the first record written by each of the program’s routines 
writes to the same disk location—thereby overwriting data already written there by 
another routine in the same program.
Figure 2-1 on page 2-18 is an example of a mixed-language TNS program that has 
COBOL, TAL, and C routines, and does not run in the CRE. The main routine is written 
in COBOL. The C and COBOL run-time libraries call system procedures to access a 
file. Because the TAL library does not provide support for input or output, TAL routines 
must send I/O requests directly to the NonStop operating system.
Sharing Standard Files Using the CRE
For Guardian programs that 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. However, the run-time library requests system services by calling 
CRE library functions rather than by calling system procedures directly. If the CRE 
receives a request to open a standard file that it has not opened at the operating 
system level, it calls the FILE_OPEN_ system procedure to open the file. Having 
opened the file, the CRE grants a connection—a path—to the same file open for each 
additional request that the CRE receives to open the same standard file. The CRE 
coordinates requests for new connections and requests to release previously granted 
connections. With the CRE, the standard files belong to a program as a whole, rather 
than to any one routine or run-time library of a program.
Figure 2-1. A C-Series Mixed-Language Process
C Run-Time Library
201VST .VSD
 $VOL
 SUBVOL.FILE
0
 1
2
3
COBOL:
TAL:
C:
 COBOL Run-Time Library
NonStop Operating System










