You cannot specify a file attribute more than once on a call to
fopen() or
freopen().
If you do, the function call fails. If the file attributes specified
on the call to
fopen() differ from the actual file attributes,
fopen() usually
fails. However,
fopen() does not fail if:
- The file is opened for w, w+, wb,
or wb+, and the file is neither an existing PDS or PDSE
nor an existing file opened by a ddname that specifies DISP=MOD.
In such instances, fopen() attributes override the actual file attributes.
However, if recfm=* (or recfm=+) is specified
on the fopen(), any attributes that are not specified either on the fopen() or
for the ddname will be retrieved from the existing file. If the final
combination of attributes is invalid, the fopen() will fail.
- The file is opened for reading (r or rb)
with recfm=U. Any other specified attributes should be
compatible with those of the existing data set.
In calls to fopen(), the LRECL, BLKSIZE, and RECFM parameters
are optional. (If you are opening a file for read or append, any attributes
that you specify must match the existing attributes.)
If you do not specify file attributes for fopen() (or for an I/O
stream object), you get the following defaults.