COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division
HP COBOL Manual for TNS/E Programs—520347-003
8-41
Timed Input and Output
When the run-time routines have recognized the exception condition, generated a run-
time diagnostic message, and stored the I-O status code, they take these actions in
this order:
1. If a declarative procedure of the form USE AFTER EXCEPTION is associated with
the file, execute the declarative procedure.
Then, if recovery from the exception is not possible (the I-O status code is “90” or
Status Key 1 is “4”), terminate the process.
If recovery from the exception is possible (either when Status Key 1 is “3,” or when
it is “9” and Status Key 2 is not “0”), and the declarative procedure has not
voluntarily terminated execution of the process, continue the execution:
a. If the statement that caused the condition includes any negative exception
handling phrase (NOT AT END or NOT INVALID KEY), transfer control to that
phrase’s imperative statement. Ignore any positive exception handling phrases
(AT END, INVALID KEY).
b. If the statement that caused the condition does not include any negative
exception handling phrase, transfer control to the statement immediately
following the terminating period or scope terminator of the I-O statement that
caused the exception condition.
2. If no applicable declarative procedure exists, terminate the process.
Timed Input and Output
Timed input-output prevents the deadlock that can occur when processes require
concurrent access to shared data files. Timed I-O is enabled for a file when the file is
opened with an OPEN statement containing a TIME LIMIT phrase. When timed I-O is
enabled for a file, you can use a TIME LIMIT phrase in a LOCKFILE, READ, or START
statement that applies to the file. The time limit is the number of seconds within which
the operation must finish. A negative time limit means “wait indefinitely” (until the
contention is resolved or the waiting process is terminated by an external agency).
Topics:
•
Expired Time Limit
•
Overhead
•
Fatal Error
•
$RECEIVE Timeout










