Default open modes

The default open modes for the C standard streams are:
stdin
r
stdout
w
stderr
w
Where the streams go depends on what kind of environment you are running under. These are the defaults:
  • Under interactive TSO, all three standard streams go to the terminal.
  • Under MVS™ batch, TSO batch, and IMS™ (batch and interactive):
    • stdin goes to dd:sysin. If dd:sysin does not exist, all read operations from stdin will fail.
    • stdout goes first to dd:sysprint. If dd:sysprint does not exist, stdout looks for dd:systerm and then dd:syserr. If neither of these files exists, z/OS® XL C/C++ opens a sysout=* data set and sends the stdout stream to it.
    • stderr will go to the z/OS Language Environment® message file. In AMODE 64 applications, stderr goes to dd:sysout.
    Note: When a standard stream is allocated to a large format sequential data set, the stream will be opened without repositioning (noseek). In this situation, the open is initially attempted with repositioning (seek), fails with an ABEND 213-14 or 213-16, and the stream is then opened without repositioning. For more information on large format sequential data sets, see Large format sequential data sets.
  • Under CICS®, stdout and stderr are assigned to transient data queues, allocated during CICS initialization. The CICS standard streams can be redirected only to or from memory files. You can do this by using freopen().
  • Under z/OS UNIX, if you are running in one of the z/OS UNIX shells, the shell controls redirection. See z/OS V2R2.0 UNIX System Services User's Guide and z/OS UNIX System Services Command Reference for information.

You can also redirect the standard streams to other files. See Redirecting standard streams and sections following.