Running Qshell commands from CL

The Start QSH (STRQSH) command, also known as QSH, is a CL (control language) command that either starts a Qshell interactive session or runs a Qshell command.

If called with the CMD parameter, STRQSH runs the specified Qshell command. The possible values of the CMD parameter are:

*NONE
No command is provided and an interactive session is started. If CMD(*NONE) is specified and STRQSH is run in a batch job, STRQSH does nothing.
command
A Qshell command to run. The command can be a maximum of 5000 bytes in length. If a blank or other special characters are used, the command must be enclosed in apostrophes. If an apostrophe is intended, two apostrophes must be used.

When running a command, STRQSH starts qsh, runs the specified Qshell command, displays any output generated by the command to the C runtime terminal session, and ends qsh. Note that qsh does not run any profile files when started to run a command.

You can control what happens to the output by setting the QIBM_QSH_CMD_OUTPUT environment variable. The environment variable can have these values:

STDOUT
Display the output to the C runtime terminal session. This is the default value.
NONE
Throw away any output that is produced.
FILE=pathname
Store the output in the file specified by pathname. The file is truncated before output is written to the file.
FILEAPPEND=pathname
Store the output in the file specified by pathname. The output is appended to end of the file.

When the command ends, STRQSH sends one of three messages:

By default, the messages are sent as completion messages. You can have the messages sent as escape messages by setting the environment variable QIBM_QSH_CMD_ESCAPE_MSG. When the value of the environment variable is "Y", the QSH0006, and QSH0007 messages are always sent as escape messages and the QSH0005 message is sent as an escape message if the exit status is greater than zero.