For OS files, the C runtime library creates a skeleton data control
block (DCB) for the file when you open it. File attributes are determined from the following
sources in this order:
- The fopen() or freopen() function call
- Attributes for a ddname specified previously (if you are opening
by ddname)
- Existing file attributes (if you specify recfm=* or
you are opening an existing file for read or append)
- Defaults from fopen() or freopen() for creating a new file.
If you do not specify
RECFM when you are creating a new file,
z/OS® XL C/C++ uses
the following defaults:
- If recfm is not specified in a fopen() call for an
output binary file, recfm defaults to:
- recfm=VB for spool (printer) files,
- recfm=FB otherwise.
- If recfm is not specified in a fopen() call for an
output text file, recfm defaults to:
- recfm=F if _EDC_ANSI_OPEN_DEFAULT is set to Y and no LRECL or BLKSIZE specified.
In this case, LRECL and BLKSIZE are both defaulted to 254.
- recfm=VBA for spool (printer) files.
- recfm=U for terminal files
- recfm=V if the LRECL or BLKSIZE is specified
- recfm=VB for all other OS files.
If
recfm is not specified for a record I/O or blocked
I/O file, you will get the default of
recfm=VB.
Table 1 shows the defaults for
LRECL and
BLKSIZE when
the
z/OS XL C/C++ compiler creates an OS file. Information from the C or
C++ program
overrides that from the
DD statement and the tape label. Information
from the
DD statement overrides that from the data set label.
Figure 1. How the operating system completes the DCB
Table 1. fopen()
defaults for LRECL and BLKSIZE when creating OS fileslrecl specified? |
blksize specified? |
RECFM |
LRECL |
BLKSIZE |
no |
no |
All F |
80 |
80 |
All FB |
80 |
maximum integral multiple of 80 less
than or equal to max |
All V, VB, VS, or VBS |
minimum of 1028 or max–4 |
max |
All U |
0 |
max |
yes |
no |
All F |
lrecl |
lrecl |
All FB |
lrecl |
maximum integral multiple of lrecl less than or equal to max |
All V |
lrecl |
lrecl+4 |
All U |
0 |
lrecl |
no |
yes |
All F or FB |
blksize |
blksize |
All V, VB, VS, or VBS |
minimum of 1028 or blksize–4 |
blksize |
All U |
0 |
blksize |
Note: All includes the standard (S) specifier for fixed formats,
the ASA (A) specifier, and the machine control character (M) specifier.
|
In
Table 1, the value
max represents
the maximum reasonable block size for the device. These are the current
default maximum block sizes for several devices that
z/OS XL C/C++ supports:
- Device
- Default maximum block size
- DASD
- 6144
- 3203 Printer
- 132
- 3211 Printer
- 132
- 4245 Printer
- 132
- 2540 Reader
- 80
- 2540 Punch
- 80
- 2501 Reader
- 80
- 3890 Document
Processor
- 80
- TAPE
- 32760
For more information about specific default block sizes as returned
by the DEVTYPE macro, refer to z/OS DFSMS Using Data Sets.
You can perform multiple buffering under z/OS. See Multiple buffering for details.