COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-7
Sharing a Terminal
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.
Topics:
•
Terminal Associated With a Command Interpreter
•
Terminal Not Associated With a Command Interpreter
•
Non-COBOL Modules
DATA DIVISION.
FILE SECTION.
FD A-TERM
RECORD CONTAINS 1 TO 79 CHARACTERS
LABEL RECORDS ARE OMITTED.
* Using 80 characters causes a blank line after the
* WRITE.
01 A-TEXT-RECORD PICTURE X(79).
WORKING-STORAGE SECTION.
01 TAUNT PIC X(17) VALUE "What do you want?".
PROCEDURE DIVISION.
A.
* Open the terminal as a file, excluding other users.
OPEN I-O A-TERM EXCLUSIVE.
B.
* Read one 79-character record. If a CTRL/Y was entered,
* quit.
READ A-TERM WITH PROMPT TAUNT
AT END GO TO HIT-EOF.
* Insert response.
MOVE "So what?" TO A-TEXT-RECORD.
* Deliver response.
WRITE A-TEXT-RECORD.
* Loop.
GO TO B.
HIT-EOF.
STOP RUN.
Example 29-3. READ Statement With PROMPT Phrase (page 2 of 2)