ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/gentrml.htm

256 lines
10 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) 2006 by IBM Corporation">
<title>Generic Terminal APIs</title>
<!-- Begin Header Records ========================================== -->
<!-- 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. -->
<!-- Change History: -->
<!-- cleaned up -->
<!-- NETMG2 SCRIPT A converted by B2H R4.1 (346) (CMS) by HOLTJM at -->
<!-- RCHVMW2 on 29 Jan 1999 at 10:01:37 -->
<!--File Edited December 2001 -->
<!-- 031112 JETAYLOR replaced API and/or Exit listings with -->
<!-- pagegenerator output from javascript array -->
<!--End Header Records -->
<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>
<a name="Top_Of_Page"></a>
<h2>Generic Terminal APIs</h2>
<p>The Generic Terminal APIs are:</p>
<!-- ***** NOTE ***** Do not manually update text or links in this section. -->
<!-- Updates made in this section *will* be overlaid by automated tools -->
<!-- Notify User Technologies of needed updates to be made in XML for API finder.-->
<!--***************API BEGIN PASTE***************-->
<ul>
<li><A HREF="cntltrml.htm">Qp0zControlTerminal()</A> (Control a Generic Terminal) allows a program to control the terminal window to which it is connected.</li>
<li><A HREF="endtrml.htm">Qp0zEndTerminal()</A> (End a Generic Terminal) ends the terminal session specified by handle.</li>
<li><A HREF="gettrmlp.htm">Qp0zGetTerminalPid()</A> (Get Process ID for a Generic Terminal) returns the process ID of the interpreter process for the terminal specified by handle.</li>
<li><A HREF="isatrml.htm">Qp0zIsATerminal()</A> (Determine Whether Descriptor Is Connected to a Generic Terminal) determines if the specified descriptor is connected to a terminal.</li>
<li><A HREF="runtrml.htm">Qp0zRunTerminal()</A> (Run a Generic Terminal) runs the terminal specified by handle.</li>
<li><A HREF="settrmlm.htm">Qp0zSetTerminalMode()</A> (Set Modes for a Generic Terminal) allows a program to control the input mode and wrap mode of the terminal window to which it is connected.</li>
<li><A HREF="startrml.htm">Qp0zStartTerminal()</A> (Start a Generic Terminal) starts a new terminal.</li>
</ul>
<!--***************API END PASTE***************-->
<br>
<h3>Generic Terminal Concepts</h3>
<p>The Generic Terminal provides an environment for running programs that use
descriptors for reading input and writing output. Typically the programs are C,
C++, or Java<SUP>(R)</SUP> programs that read input from standard input, write regular output
to standard output, and write error output to standard error.</p>
<p>A terminal is started, run, and ended from an interactive job. When a
terminal is started by <a href="startrml.htm">Qp0zStartTerminal()</a>, an
interpreter process is started in batch with descriptors 0, 1, and 2 connected
to pipes in the interactive job. A user specified program runs in the
interpreter process. After calling <a href="runtrml.htm">Qp0zRunTerminal()</a>,
an interactive user can send input to the program and see the output written by
the program. The resources used by the terminal are cleaned up by calling <a
href="endtrml.htm">Qp0zEndTerminal()</a>. It closes the pipes and ends the
interpreter process.</p>
<br>
<h3>Terminal Window</h3>
<p>After calling <a href="runtrml.htm">Qp0zRunTerminal()</a>, the terminal
window is displayed. The interactive user enters input that is sent to the
interpreter process and sees output that comes from the interpreter process.
The terminal window has these parts:</p>
<ul>
<li>A title line identifies the terminal window. The title is set in the
Qp0z_Terminal_Attr_T parameter of <a href="startrml.htm">
Qp0zStartTerminal()</a>.<br>
<br>
</li>
<li>An output area that contains an echo of the commands that were entered and
any output from the interpreter process. When a program in the interpreter
process writes to descriptors 1 or 2, the output is displayed in the output
area.<br>
<br>
</li>
<li>An input line for entering commands. The input is written to descriptor 0
in the interpreter process.<br>
<br>
</li>
<li>A command key description. There are two lines of command key descriptions
that are set in the Qp0z_Terminal_Attr_T parameter of <a href="startrml.htm">
Qp0zStartTerminal()</a>.<br>
<br>
</li>
<li>A message line where messages to the user are displayed.</li>
</ul>
<p>The terminal window supports these command keys:</p>
<table border width="80%">
<tr>
<th valign="top">Command Key</th>
<th valign="top">Description</th>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F3 (Exit)</td>
<td align="left" valign="middle" width="70%">Returns to the caller of <a href=
"runtrml.htm">Qp0zRunTerminal()</a> with a return value of 1 (or
QP0Z_TERMINAL_F3).</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F5 (Refresh)</td>
<td align="left" valign="middle" width="70%">Refreshes the output area.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F6 (Print)</td>
<td align="left" valign="middle" width="70%">Prints the output area to a QPRINT
spool file.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F7 (Page up)</td>
<td align="left" valign="middle" width="70%">Page up output area. If a number
is on the command line, the output area is rolled up by that number of
lines.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F8 (Page down)</td>
<td align="left" valign="middle" width="70%">Page down output area. If a number
is on the command line, the output area is rolled down by that number of
lines.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F9 (Retrieve)</td>
<td align="left" valign="middle" width="70%">Retrieve a previous command. If
the key is pressed multiple times, it retrieves previous commands from a
buffer. For example, to retrieve the second to last command, press the key two
times. A specific command can be selected by placing the cursor on that command
and pressing the key. When the interactive job is running in a double-byte
CCSID, this key is not available.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F11 (Toggle line wrap)</td>
<td align="left" valign="middle" width="70%">Toggles 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.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F12 (Return)</td>
<td align="left" valign="middle" width="70%">Returns to the caller of <a href=
"runtrml.htm">Qp0zRunTerminal()</a> with a return value of 0 (or
QP0Z_TERMINAL_F12).</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F13 (Clear)</td>
<td align="left" valign="middle" width="70%">Clears the output area.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F14 (Adjust command line
length)</td>
<td align="left" valign="middle" width="70%">Adjust the command line length to
four lines. If a number is on the command line, the command line length is
adjusted to that number of lines.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F17 (Top)</td>
<td align="left" valign="middle" width="70%">Displays top of output area.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F18 (Bottom)</td>
<td align="left" valign="middle" width="70%">Displays bottom of output
area.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F19 (Left)</td>
<td align="left" valign="middle" width="70%">Shifts the output area to the
left. If a number is on the command line, the output area is shifted by that
number of columns.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F20 (Right)</td>
<td align="left" valign="middle" width="70%">Shifts the output area to the
right. If a number is on the command line, the output area is shifted by that
number of columns.</td>
</tr>
<tr>
<td align="center" valign="middle" width="30%">F21 (CL command line)</td>
<td align="left" valign="middle" width="70%">Displays a command entry window
where the user can enter CL commands.</td>
</tr>
</table>
<br>
<br>
<h3>Programs running in the interpreter process</h3>
<p>The program can use descriptor 0 (or standard input) to read input,
descriptor 1 (or standard output) to write regular output, and descriptor 2 (or
standard error) to write error output. The program can use the following
functions to work with the terminal to which it is connected.</p>
<ul>
<li>Use <a href="isatrml.htm">Qp0zIsATerminal()</a> to see if a descriptor is
connected to a terminal.<br>
<br>
</li>
<li>Use <a href="cntltrml.htm">Qp0zControlTerminal()</a> to control the
terminal window. For example, page up or page down in the terminal window.<br>
<br>
</li>
<li>Use <a href="settrmlm.htm">Qp0zSetTerminalMode()</a> to set terminal modes.
For example, switch to hidden input mode to read a password.&gt;</li>
</ul>
<p>The program also needs to decide how to handle the following signals:</p>
<ul>
<li>The terminal sends signal SIGINT when the interactive user enters SysReq 2
to interrupt the current request.<br>
<br>
</li>
<li>The terminal sends signal SIGHUP when the terminal is ended.</li>
</ul>
<hr>
<table cellpadding="2" cellspacing="2" align="center">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</body>
</html>