Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)
Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual—426750-003
6-143
USE FOR TERMINAL-ERRORS Statement
•
Pathway logging is not performed on errors handled by the USE FOR TERMINAL-
ERRORS procedure.
•
If an irrecoverable terminal I/O error occurs during an ACCEPT statement, the TCP
resets TERMINATION-STATUS to zero before returning to the statement following
the ACCEPT.
•
If you call another SCREEN COBOL program unit from within a USE FOR
TERMINAL-ERRORS declaratives procedure:
°
The called program (and any program it calls) must not contain a USE FOR
TERMINAL-ERRORS statement; if it does, a run-time error occurs and the
program suspends.
°
An irrecoverable terminal I/O error in the called program will cause the calling
program to suspend.
You should consider the nature of the error before attempting a retry within the
Declaratives section. Some errors can be retried, others cannot. To determine the
nature of the error, you can check the TERMINATION-SUBSTATUS special register
for the file-system error code.
If the declaratives procedure does not contain any executable statement, execution
resumes with the next statement following the statement that caused the error. Thus,
irrecoverable terminal I/O errors can occur with no indication that they have occurred.
One way to avoid this situation is to include at least one statement in the declaratives
procedure, possibly an EXIT PROGRAM statement.
The Declaratives procedures can be used to save current data (context). Saving
current data by using the declaratives procedures lets you resume the application with
a more completely recovered screen than is possible with, for instance, EXIT
PROGRAM WITH ERROR or CALL...ON ERROR when used outside the declaratives
procedure. The following example saves the current and last record when a terminal
I/O error occurs.
. . .
DATA DIVISION.
WORKING-STORAGE SECTION.
01 CONTEXT-INFO.
02 CURRENT-REC.
04 NAME PIC A(33).
04 ACCT-NUM.
06 ACCT-PRE PIC AA.
06 ACCT-SN PIC 99999.
06 ACCT-SUFF PIC X(4).
04 ACT-BAL PIC 999999V99.
02 LAST-REC.
04 NAME PIC A(33).
04 ACCT-NUM.
06 ACCT-PRE PIC AA.
06 ACCT-SN PIC 99999.
06 ACCT-SUFF PIC X(4).
04 ACT-BAL PIC 999999V99.










