Understanding standard input, standard output, and standard error
Once a command begins running, it has access to three files:
- It reads from its standard input file. By default, standard input is the keyboard.
- It writes to its standard output file.
- If you invoke a shell command from the shell, a C program, or a REXX program invoked from TSO READY, standard output is directed to your terminal screen by default.
- If you invoke a shell command, REXX program, or C program from the ISPF shell, standard output cannot be directed to your terminal screen. You can specify a z/OS UNIX file or use the default, a temporary file.
- It writes error messages to its standard error file.
- If you invoke a shell command from the shell or from a C program or from a REXX program invoked from TSO READY, standard error is directed to your terminal screen by default.
- If you invoke a shell command, REXX program, or C program from
the ISPF shell,
standard error cannot be directed to your terminal screen. You can
specify a z/OS UNIX file
or use the default, a temporary file.
If the standard output or standard error file contains any data when the command completes, the file is displayed for you to browse.
Using the shell: In the shell, the names for these files
are:
- stdin for the standard input file.
- stdout for the standard output file.
- stderr for the standard error file.
The shell sometimes refers to these files by their file descriptors, or
identifiers:
- 0 for stdin
- 1 for stdout
- 2 for stderr
Using TSO/E: When you are invoking the BPXBATCH utility,
you can specify these standard files in MVS™ DD
statements, TSO/E ALLOCATE commands, or DYNALLOC macros using the
ddnames:
- STDIN for standard input
- STDOUT for standard output
- STDERR for standard error
For more information about BPXBATCH, see The BPXBATCH utility.
Using ISPF: When you run shell commands, REXX programs, and C programs from the ISPF shell, stdout, and stderr cannot be directed to your terminal. You can specify a z/OS UNIX file, or use the default—a temporary file. If it has any contents, the file is displayed for you to browse when the command or program completes.