CRE Programmer's Guide
CRE Service Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
6-17
CRE_File_Open_
•
Opening terminals and processes
A standard file can access a terminal or a process (except a spooler collector) for
both input and output. If the file you specify for standard input is the same as the
file you specify for standard output or standard log, the CRE opens the operating
system file only once, although you must invoke CRE_File_Open_ once for the
read component of the open, and once for the write component of the open. The
CRE, however, opens the operating system file only once and specifies read-write
access.
•
Disk files
You can specify an existing or nonexistent disk file as a standard file. If you specify
a file that does not exist, CRE_File_Open_ attempts to create a file. If it is unable
to create a file, either because you specified an unacceptable access (for example,
you open a nonexistent file as read-only) or because the operating system
returned an error when CRE_File_Open_ attempted to create the file,
CRE_File_Open_ returns an error.
°
The FILE_OPEN_ and EDITREADINIT system procedures if your
program’s main routine is written in COBOL or FORTRAN, specifies that it
is to run as a process pair, and opens the file for read-only access. If your
FORTRAN or COBOL routine specifies that it is to run as a process pair
and attempts to open an EDIT file with an access mode other than read-
only, CRE_File_Open_ returns error 67, “access mode not accepted.”
°
Files other than EDIT files
CRE_File_Open_ opens all files other than EDIT files by calling the
FILE_OPEN_ system procedure.
°
EDIT files
CRE_File_Open_ opens EDIT files using:
°
The OPENEDIT_ system procedure if your program’s main routine is
written in C/C++, pTAL, or TAL, or is written in COBOL or FORTRAN and
does not specify that it is to run as a process pair.
°
Nonexistent disk files
If your program specifies a nonexistent disk file and an access mode other
than read-only, CRE_File_Open_ attempts to create a file for you.
CRE_File_Open_ creates:
Note. Some of the descriptions in this subsection specify different CRE actions depending on
whether a program’s main routine specifies that the program runs as a process pair. In all such
cases, the actions of the CRE are based solely on whether the main routine specifies that the
program runs as a process pair, regardless of whether the program initiates process pairs or
whether the program is running as a process pair.