Exiting the shell

There are four situations when you might want to exit the shell:
  • To leave the shell temporarily and switch to TSO/E command mode: Press the TSO function key. You can do this any time during a session, regardless of whether you are currently running a command or script. See Performing TSO/E work or ISPF work after invoking the shell for details.

    If you switch to TSO/E command mode, the shell and any shell commands continue running until they attempt to read from the terminal or until the terminal output buffer is full; if either of these situations occurs, the commands are suspended until you return to the shell.

  • To exit the shell when a foreground process has completed: Type exit or <EscChar-D>. Scroll past all the output data (or use an autoscroll function key if you have customized a function key to do that), and exit.
    Note: The <EscChar-D> sequence does not work if you have entered set -o ignoreeof in the shell. See the set command description in z/OS UNIX System Services Command Reference.
    If you are using the shell option set +m or its equivalent set +o monitor to have background jobs run in the same process group as the shell, use the nohup command to run a script or program that will continue running after you log out.

    If you were in ISPF when you entered the shell, you are returned to ISPF; if you were in TSO READY mode, you are returned to TSO/E READY.

  • To exit the shell when a background job is running: Press the SubCmd function key and then enter the QUIT subcommand. If your OMVS interface is running in SHAREAS mode (shared address space) and you quit all sessions (QUITALL subcommand or QUIT for the only session), the shell process ends immediately.

    If you were in ISPF when you entered the shell, you are returned to ISPF; if you were in TSO/E READY mode, you are returned to TSO READY.

    By default in the shell (the set -m option), a background job runs in a different process group from the shell, and the job keeps running after you exit the shell. To have background jobs run in the same process group as the shell, use the set +m command or its equivalent, set +o monitor.

  • If your application is in a loop: Try using <EscChar-C> or <EscChar-V> to interrupt it. If this does not work, press the SubCmd function key to leave the shell. Then type quit and press <Enter>. This causes the OMVS command to quit abruptly. The workstation returns to TSO/E and the shell stops processing. For more information on using escape sequences such as <EscChar-C>, see Typing escape sequences in the shell.