Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)

Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual426750-003
6-142
USE FOR TERMINAL-ERRORS Statement
The following SCREEN COBOL statements add data to the terminal buffers and thus
could cause an irrecoverable terminal I/O error:
ACCEPT DISPLAY
CLEAR INPUT RECONNECT MODEM
DISPLAY BASE RESET
DISPLAY OVERLAY SCROLL
DISPLAY RECOVERY TURN
For programs operating in conversational mode, an irrecoverable terminal I/O error can
be associated directly with one of the statements listed. For programs operating in
block mode, the error might not result directly from one of these statements.
In block mode, output data is buffered and an irrecoverable terminal I/O error occurs
only when data is actually written to or read from the terminal. A number of input or
output statements could be executed before the buffer fills or some other action forces
an actual write to the terminal. In block mode, actual terminal writes occur in the
following situations:
When the terminal buffer is full
Before executing an ACCEPT statement
Before executing statements such as DELAY, SEND, or CALL
If an irrecoverable terminal I/O error occurs and you have included a USE FOR
TERMINAL-ERRORS procedure in your program, the TCP performs the following
actions:
1. Sets the TERMINATION-SUBSTATUS special register to the appropriate file-
system error code
2. Sets the PW-TERMINAL-ERROR-OCCURRED special register to 1 (otherwise, it
is set to zero)
3. Executes the declaratives procedure immediately following the USE FOR
TERMINAL-ERRORS statement
4. Resumes execution at the statement immediately following the statement during
which the I/O failure occurred
If an error occurs in the declaratives procedure itself, the TCP sets the special registers
PW-TERMINAL-ERROR-OCCURRED to 1 and TERMINATION-SUBSTATUS to the
file-system error code just as in steps 1 and 2, but resumes execution at the next
statement in the procedure itself.
The USE FOR TERMINAL-ERRORS declarative is both simple and powerful. It allows
you maximum control when a terminal I/O error occurs, but it can lead to unexpected
results. You should be careful both in how you use this procedure and for what
purpose.
Consider the following:
In block mode, you have no way of knowing which statement caused the error.