117 lines
4.8 KiB
HTML
117 lines
4.8 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<META name="Copyright" content="Copyright (c) 2004 by IBM Corporation">
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<TITLE>qsh, qsh_inout, qsh_out - Run a QShell command for i5/OS PASE</TITLE>
|
|
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|
</HEAD>
|
|
<BODY>
|
|
<!-- Java sync-link -->
|
|
<SCRIPT language="Javascript" src="../rzahg/synch.js" type="text/javascript"></SCRIPT>
|
|
|
|
<h2>
|
|
qsh, qsh_inout, qsh_out - Run a QShell command for i5/OS PASE
|
|
</h2>
|
|
<p>
|
|
<strong>Syntax</strong>
|
|
</p>
|
|
<pre>
|
|
<strong>qsh</strong> [<var>command-options</var>]
|
|
|
|
|
|
<strong>qsh_inout</strong> [<var>command-options</var>]
|
|
|
|
<strong>qsh_out</strong> [<var>command-options</var>]
|
|
|
|
</pre>
|
|
<p>
|
|
<strong>Description</strong>
|
|
</p>
|
|
<p>
|
|
The i5/OS<sup>R</sup> PASE <strong>qsh</strong>,
|
|
<strong>qsh_inout</strong>, and <strong>qsh_out</strong> commands run a QShell command. These
|
|
commands use the i5/OS PASE <strong>system</strong> 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.
|
|
</p>
|
|
<p>
|
|
The i5/OS PASE <strong>qsh</strong>, <strong>qsh_inout</strong>, and <strong>qsh_out</strong>
|
|
commands all provide the syntax and behavior of the QShell <strong>qsh</strong> command, with
|
|
additional support for ASCII/EBCDIC conversion of standard I/O provided by the i5/OS PASE
|
|
<strong>system</strong> command. Any other command name that links to i5/OS PASE
|
|
<strong>qsh</strong>, <strong>qsh_inout</strong>, or <strong>qsh_out</strong> (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:</p>
|
|
<ul>
|
|
<li>
|
|
<a href="pase_system.htm"><strong>system</strong> - Run a CL Command for i5/OS PASE</a>
|
|
</li>
|
|
<li>
|
|
<a href="../rzahz/qsh.htm"><strong>qsh</strong> - QShell Command Language Interpreter</a>
|
|
(QShell version)
|
|
</li>
|
|
</ul>
|
|
<p>
|
|
The <strong>qsh</strong> and <strong>qsh_inout</strong> commands do ASCII/EBCDIC conversion for
|
|
standard input, standard output, and standard error. The <strong>qsh_out</strong> command only
|
|
does ASCII/EBCDIC conversion for standard output and standard error.
|
|
</p>
|
|
<p>
|
|
You need to set ILE environment variable <strong>QIBM_USE_DESCRIPTOR_STDIO</strong> 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
|
|
<strong>QP2TERM</strong> uses to run i5/OS PASE shells and utilities.
|
|
</p>
|
|
<p>
|
|
See the following topics for related information:
|
|
</p>
|
|
<p>
|
|
<strong>Examples</strong>
|
|
</p>
|
|
<p>
|
|
You should use <strong>qsh_out</strong> (instead of
|
|
<strong>qsh</strong> or <strong>qsh_inout</strong>) when the QShell command does not read from
|
|
standard input to avoid unintended repositioning of the input stream. This example uses
|
|
<strong>qsh_out</strong> to avoid repositioning the stream processed by the
|
|
<strong>read</strong> command, and simply echos the contents of file "myinput" to standard
|
|
output:
|
|
</p>
|
|
<pre>
|
|
while read ; do
|
|
qsh_out -c "echo $REPLY"
|
|
done < myinput
|
|
</pre>
|
|
<p>
|
|
This example uses the QShell <strong>cat</strong> 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 <strong>cat</strong> command is
|
|
used:
|
|
</p>
|
|
<pre>
|
|
qsh_out -c 'cat /qsys.lib/qsysinc.lib/h.file/sqlcli.mbr' > ascii_sqlcli.h
|
|
</pre>
|
|
<p>
|
|
The system provides an i5/OS PASE <strong>getjobid</strong> command using symbolic link
|
|
/QOpenSys/usr/bin/getjobid -> qsh_out to run the QShell <strong>getjobid</strong> 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 <strong>getjobid</strong> command writes a line to standard
|
|
output:
|
|
</p>
|
|
<pre>
|
|
getjobid $$
|
|
|
|
qsh_out -c "/usr/bin/getjobid $$"
|
|
|
|
</pre>
|
|
</body>
|
|
</html>
|
|
|