CRE Programmer's Guide
CRE Services
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
2-19
Sharing Standard Files Using the CRE
For example, if you have routines written in C, COBOL, and TAL, requests to write to
standard output from each of the routines can be coordinated by the CRE. (The C and
COBOL run-time libraries call CRE functions directly. Because the TAL run-time library
does not support I/O operations, routines written in TAL must call CRE functions
directly in order to use the standard files features of the CRE.) If routines in each of the
three languages open and write to the same disk file, no data is lost because the CRE
enables the routines to share the file record pointer.
Standard input and standard output usually correspond to the files you specify with the
IN and OUT parameters when you run a program from TACL. The CRE uses the file
names you specify on PARAMs and ASSIGNs to locate standard log. See Standard
Log on page 2-33 for a detailed explanation of how the CRE determines the physical
name of standard log.
The CRE opens a standard file only when a run-time library for one of your routines
requests that CRE open the file. Standard log, however, is also used by the CRE itself.
The CRE might open it before it receives a request from one of your routines. The CRE
library, run-time libraries, and your routines can write diagnostic messages to standard
log. CRE_File_Message_ on page 6-9 describes how you can write messages to
standard log.
The CRE closes a standard file only when all routines with connections to a standard
file close the file. Your program might need to close all opens to a file in order to
release the file. For example, you might want to print a spooler file without terminating
your program.
The following legend applies to Figure 2-2 on page 2-20 through Figure 2-9 on
page 2-27.
Figure 2-2 through Figure 2-5 show a sequence of opens to standard output by a
program consisting of routines written in TNS COBOL, TAL, and C. In the example,
standard output is a disk file named $VOL.SUBVOL.FILE. The main routine is written
in COBOL.
•
Figure 2-2 on page 2-20 shows a quiescent system. Standard output has not been
opened by any routine. There are no operations in progress so all paths are
dashed lines and all objects are white boxes.
•
Figure 2-3 on page 2-21 shows an active TNS COBOL routine. However, TNS
COBOL routines do not explicitly open standard files. Instead, the TNS COBOL
run-time library opens standard output the first time a TNS COBOL routine
executes a DISPLAY statement.
202VST .VSD
A dashed line is a path that exists but is not currently active.
A solid line is a path that is active for the current operation.
A white object is inactive for the current operation.
A shaded object is active for the current operation.