COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

MOVE "So what?" TO A-TEXT-RECORD.
* Deliver response.
WRITE A-TEXT-RECORD.
* Loop.
GO TO B.
HIT-EOF.
STOP RUN.
Sharing a Terminal
For development, you normally use a terminal that is associated during system generation with a
command interpreter (such as TACL). That command interpreter uses your terminal as its IN file,
its OUT file, and its home terminal.
Most terminals on a production system do not have command interpreters associated with them.
Each production terminal is directly associated with a production process, either as a terminal
running under the control of a Pathway/TS terminal control process (TCP) or as a terminal that can
be accessed by a process.
Terminal Associated With a Command Interpreter
When a command interpreter has a terminal open for its IN and OUT file, an HP COBOL process
can open that terminal as a file only if it opens it for shared access (the default). It cannot open
such a terminal for exclusive access, even if the command interpreter does not accept messages
from or send messages to that terminal for the duration of the HP COBOL process’s execution. If
you want an HP COBOL process to have exclusive use of a terminal, no command interpreter can
have the terminal open.
To free a terminal that is running TACL for use as a file by an HP COBOL program, enter the TACL
command PAUSE.
Terminal Not Associated With a Command Interpreter
When a terminal is not connected to a command interpreter, an HP COBOL process can open it,
read from it, write to it, or close it like any other file. See Using a Terminal as a File.
Non-COBOL Modules
If your program consists of modules written in different languages, the modules can share the
standard files—the predefined files called “standard input,” “standard output,” and “standard log.
The standard input, output, and log file can be a terminal.
For more information about mixed-language programs sharing standard files, see the CRE
Programmer’s Guide.
Getting Break Ownership
When you press Break on a terminal, the process that owns Break receives a system message on
$RECEIVE. A process discovers that Break has been pressed by reading $RECEIVE. An HP COBOL
process, lacking the ability to perform NOWAIT input and output directly, must open $RECEIVE
with an OPEN statement with a TIME LIMITS phrase and then try to read $RECEIVE from time to
time. If a READ statement fails because it timed out, Break was not pressed.
When a command interpreter starts a process, whether or not the process uses the command
interpreter’s terminal for any input or output, the command interpreter retains ownership of Break
Sharing a Terminal 893