z/OS UNIX System Services User's Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Understanding standard input, standard output, and standard error

z/OS UNIX System Services User's Guide
SA23-2279-00

Once a command begins running, it has access to three files:

  1. It reads from its standard input file. By default, standard input is the keyboard.
  2. 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.
  3. 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
For more information about the file descriptors that the shell supports, see the sh command description in z/OS UNIX System Services Command Reference.
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.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014