STRQSH (Start QSH)
Purpose
The Start QSH (STRQSH) command starts the qsh command shell interpreter.
QSH is an alias for this CL command.
Optional Parameters
- CMD
- Specifies the shell command to be run.
*NONE: No command is provided. If run in an interactive job, STRQSH starts an interactive shell session. If a shell session is not already active in the job, then:
- A new shell session is started and a terminal window is displayed.
- qsh runs the commands from the file /etc/profile if it exists.
- qsh runs the commands from the file specified by the expansion of {$HOME/.profile} if it exists.
- qsh runs the commands from the file specified by the expansion of the ENV variable if it exists.
If a shell session is already active in an interactive job, you are reconnected to the existing session. From the terminal window, you can enter shell commands and view output from the commands.
Use the Terminal Window
The terminal window has two parts:
- an input line for entering commands, and
- an output area that contains an echo of the commands you entered and any output generated by the commands.
The terminal window supports the following function keys:
- F3 (Exit)
- Close the terminal window and end the qsh session.
- F6 (Print)
- Print the output area to a spool file.
- F7 (Up)
- Roll output area up one page.
- F8 (Down)
- Roll output area down one page.
- F9 (Retrieve)
- Retrieve a previous command. You can press this key multiple times to retrieve any previous command. For example, to retrieve the second to last command you entered, press this key two times. You can also select a specific command to be run again by placing the cursor on that command and pressing this key. When the interactive job is running in a double-byte CCSID, this key is not available.
- F11 (Toggle line wrap)
- Toggle the line wrap/truncate mode in the output area. In line wrap mode, lines longer than the width of the terminal window are wrapped to the next line. In truncate mode, the portion of a line beyond the width of the terminal window is not shown.
- F12 (Disconnect)
- Disconnect from the qsh session. This key only closes the terminal window and does not end the qsh session. You can redisplay the disconnected qsh session by running STRQSH again.
- F13 (Clear)
- Clear the output area.
- F14 (Move)
- Move the terminal window on your screen.
- F15 (Resize)
- Resize the terminal window on your screen.
- F17 (Top)
- Display top of output area.
- F18 (Bottom)
- Display bottom of output area.
- F21 (CL command line)
- Display a command entry window where you can enter CL commands.
If CMD(*NONE) specified and STRQSH is run in a batch job, STRQSH does nothing.
'command': Specify a character string of up to 1024 characters that represents a command that is run by qsh.
The command must be enclosed in apostrophes if it contains embedded blanks or special characters.
STRQSH starts a shell interpreter, runs the specified command, prints output generated by the command, and ends the shell interpreter.
Examples for STRQSH
Example 1: Run a Shell Command
STRQSH CMD('javac mypgm')This starts a command shell interpreter, runs the javac command, and ends the shell interpreter. Any output generated to stdout by the javac command will be printed.
Example 2: Start the Shell Interpreter
STRQSHIf the command is run in an interactive job, a shell session is started and a terminal window is displayed. If the command is run in a batch job, nothing is done.
Error messages for STRQSH
*ESCAPE Messages
- QSH0002
- Error found with QSH session, reason code &1, errno &2.