z/OS® XL C/C++ makes a distinction between types of error output according to whether the output is directed to the MSGFILE, to stderr, or to stdout:
Destination of Output | Type of Message | Produced by | Default Destination |
---|---|---|---|
MSGFILE output | z/OS Language Environment® messages (CEExxxx) | z/OS Language Environment conditions | MSGFILE ddname |
z/OS XL C/C++ language messages (EDCxxxx) | z/OS XL C/C++ unhandled conditions | MSGFILE ddname | |
stderr messages | perror() messages (EDCxxxx) | Issued by a call, for example, to: perror() | MSGFILE ddname (see note 1) |
User output sent explicitly to stderr | Issued by a call to fprintf() | MSGFILE ddname | |
stdout messages | User output sent explicitly to stdout | Issued by a call, for example, to: printf() | stdout (see note 2) |
Notes:
|
All stderr output is by default sent to the MSGFILE destination, while stdout output is sent to its own destination. When stderr is redirected to stdout, both share the stdout destination. When stdout is redirected to stderr, both share the stderr destination.
If you specified one of the DDs used in the stdout open search order as the DD for the MSGFILE option, then that DD will be ignored in the stdout open search.
Table 2 describes the destination of output to stderr and stdout after redirection has occurred. Whenever stdout and stderr share a common destination, the output is interleaved. The default case is the one where stdout and stderr have not been redirected.
stderr not redirected | stderr redirected to destination other than stdout | stderr redirected to stdout | |
---|---|---|---|
stdout not redirected | stdout to itself stderr to MSGFILE | stdout to itself stderr to its other destination | Both to stdout |
stdout redirected to destination other than stderr | stdout to its other destination stderr to MSGFILE | stdout to its other destination stderr to its other destination | Both to the new stdout destination |
stdout redirected to stderr | Both to MSGFILE | Both to the new stderr destination | stdout to stderr stderr to stdout |
By default, z/OS XL C/C++ sends all stderr output to the MSGFILE destination and stdout output to its own destination. You can change this by using z/OS XL C/C++ redirection, which enables you to redirect stdout and stderr to a ddname, file name, or each other. Unless you have redirected stderr, it always uses the MSGFILE destination. When you redirect stderr to stdout, stderr and stdout share the stdout destination. When you redirect stdout to stderr, they share the stderr destination.