COBOL Manual for TNS and TNS/R Programs

Procedure Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
8-41
Timed Input and Output
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
Expired Time Limit
An expired time limit indicates a potential deadlock. The programmed recovery action
(declarative procedure) must release any locks held by the program and restart the
execution of the current request.
If no declarative procedure applies to the file when the operation terminates, the
program terminates abnormally.
If a declarative procedure does apply to the file and the time limit expires, the
declarative procedure is performed and program execution continues with the
statement following the one terminated.