qsh, qsh_inout, qsh_out - Run a QShell command for i5/OS PASE

Syntax

  qsh [command-options]


  qsh_inout [command-options]

  qsh_out [command-options]

Description

The i5/OSR PASE qsh, qsh_inout, and qsh_out commands run a QShell command. These commands use the i5/OS PASE system command to copy i5/OS PASE environment variables to the ILE environment and then call the QShell command program through a link in directory /usr/bin.

The i5/OS PASE qsh, qsh_inout, and qsh_out commands all provide the syntax and behavior of the QShell qsh command, with additional support for ASCII/EBCDIC conversion of standard I/O provided by the i5/OS PASE system command. Any other command name that links to i5/OS PASE qsh, qsh_inout, or qsh_out (in directory /QOpenSys/usr/bin) provides the same syntax and behavior as the QShell command in directory /usr/bin with the same base name as the link. See the following topics for more information:

The qsh and qsh_inout commands do ASCII/EBCDIC conversion for standard input, standard output, and standard error. The qsh_out command only does ASCII/EBCDIC conversion for standard output and standard error.

You need to set ILE environment variable QIBM_USE_DESCRIPTOR_STDIO to Y or I (so that i5/OS PASE runtime and ILE C runtime use descriptor standard I/O) to avoid unpredicatable results. This is done by default in the i5/OS jobs that program QP2TERM uses to run i5/OS PASE shells and utilities.

See the following topics for related information:

Examples

You should use qsh_out (instead of qsh or qsh_inout) when the QShell command does not read from standard input to avoid unintended repositioning of the input stream. This example uses qsh_out to avoid repositioning the stream processed by the read command, and simply echos the contents of file "myinput" to standard output:

      while read ; do
          qsh_out -c "echo $REPLY"
      done < myinput

This example uses the QShell cat command to convert text in an i5/OS source database file to the (ASCII) i5/OS PASE CCSID and store the result in a stream file named ascii_sqlcli.h. This takes advantage of support in the QShell utility to insert linend characters in the stream that are not added if the i5/OS PASE cat command is used:

      qsh_out -c 'cat /qsys.lib/qsysinc.lib/h.file/sqlcli.mbr' > ascii_sqlcli.h

The system provides an i5/OS PASE getjobid command using symbolic link /QOpenSys/usr/bin/getjobid -> qsh_out to run the QShell getjobid command. This example shows two ways to run the QShell utility to determine the name of the i5/OS job running the i5/OS PASE shell. The first example is more efficient because it avoids running QShell interpreter. Variable $$ is expanded by the i5/OS PASE shell (to the process identifier of the shell), and the QShell getjobid command writes a line to standard output:

      getjobid $$

      qsh_out -c "/usr/bin/getjobid $$"