Opening files
This section discusses the use of the fopen()
or freopen()
library functions to open
z/OS® UNIX file system I/O files. You can
also access z/OS UNIX file system files
using low-level I/O open()
function. See
Low-level z/OS UNIX I/O for information about low-level I/O, and z/OS XL C/C++ Runtime Library Reference for information about any of
the functions listed above.
The name of a z/OS UNIX file system file can include characters chosen from the complete set of character values, except for null characters. If you want a portable filename, then choose characters from the POSIX .1 portable filename character set.
The complete pathname can begin with a slash and be followed by zero, one, or more filenames, each separated by a slash. If a directory is included within the pathname, it may have one or more trailing slashes. Multiple slashes following one another are interpreted as one slash.
If your program is running under POSIX(ON)
, all valid
POSIX names are passed with the asis
fopen()
parameter
to the POSIX open()
function.
You can access either z/OS UNIX file system files or MVS™ data
sets from programs. Programs accessing files or data sets can be executed
with either the POSIX(OFF)
or POSIX(ON)
runtime
options. There are basic file naming rules that apply for z/OS UNIX file
system files and MVS data sets. However, there are also
special z/OS XL C/C++ naming considerations that depend on how you execute
your program.
The POSIX runtime option determines the type of z/OS XL C/C++ services and I/O available to your program. (See z/OS XL C/C++ User's Guide for a discussion of the z/OS UNIX programming environment and overview of binding z/OS UNIX XL C/C++ applications.)
Both the basic and special z/OS XL C/C++ file naming rules for z/OS UNIX file
system files are described in the sections that follow. Examples are
provided. All examples must be run with the POSIX(ON)
option.
For information about MVS data sets, see Performing OS I/O operations.