Generic Terminal APIs

The Generic Terminal APIs are:


Generic Terminal Concepts

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(R) programs that read input from standard input, write regular output to standard output, and write error output to standard error.

A terminal is started, run, and ended from an interactive job. When a terminal is started by Qp0zStartTerminal(), 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 Qp0zRunTerminal(), 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 Qp0zEndTerminal(). It closes the pipes and ends the interpreter process.


Terminal Window

After calling Qp0zRunTerminal(), 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:

The terminal window supports these command keys:

Command Key Description
F3 (Exit) Returns to the caller of Qp0zRunTerminal() with a return value of 1 (or QP0Z_TERMINAL_F3).
F5 (Refresh) Refreshes the output area.
F6 (Print) Prints the output area to a QPRINT spool file.
F7 (Page up) Page up output area. If a number is on the command line, the output area is rolled up by that number of lines.
F8 (Page down) Page down output area. If a number is on the command line, the output area is rolled down by that number of lines.
F9 (Retrieve) 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.
F11 (Toggle line wrap) 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.
F12 (Return) Returns to the caller of Qp0zRunTerminal() with a return value of 0 (or QP0Z_TERMINAL_F12).
F13 (Clear) Clears the output area.
F14 (Adjust command line length) 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.
F17 (Top) Displays top of output area.
F18 (Bottom) Displays bottom of output area.
F19 (Left) 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.
F20 (Right) 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.
F21 (CL command line) Displays a command entry window where the user can enter CL commands.


Programs running in the interpreter process

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.

The program also needs to decide how to handle the following signals:


Top | UNIX-Type APIs | APIs by category