COBOL Manual for TNS and TNS/R Programs

Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
28-40
Using Enscribe and Operating System Routines
Suppose that you attempt to read the file OAK with a statement such as:
READ OAK-FILE RECORD TIME LIMIT 5 AT END PERFORM END-OAK.
IF OAK-ERROR = TIME-OUT-CODE
...
When the read operation cannot be completed within 5 seconds, control passes to the
USE procedure for the OAK file, which can adjust the program’s behavior
appropriately. The USE procedure displays a diagnostic to the OUT file. The program
could retry a certain number of times, or (if it is a server) report back to its requester
that the read operation could not be completed, which is another way to handle a file
that might be locked at the file or record level.
Using Enscribe and Operating System
Routines
Enscribe routines are a subset of operating system routines that function collectively as
the operating environment’s database record manager. All processes use Enscribe
routines to interact with records in disk files in the database. HP COBOL run-time
routines that perform input-output operations do so by calling Enscribe routines, but
they also handle HP COBOL-related processing that Enscribe does not, such as
declaratives and file status code data items.
An HP COBOL program can call an Enscribe or other operating system routine with
the ENTER statement. Some Enscribe and operating system routines are not safe to
use from an HP COBOL program; others are.
Topics:
Physical File Names
Obtaining File Numbers and Other File Attributes
Determining Whether Two COBOL File Names Specify the Same Physical File
Purging a File From an HP COBOL Program
Purging the Contents of a File From an HP COBOL Program
Renaming a File From an HP COBOL Program
Creating a File Having Alternate Keys From an HP COBOL Program
Caution. Generally, it is not safe to mix HP COBOL input-output operations and direct calls to
Enscribe input-output routines for the same open file. Although you can use HP COBOL
statements to open, close, and checkpoint a file and also call Enscribe routines to perform
operations that HP COBOL does not provide, calling Enscribe routines disables useful
HP COBOL tools such as declaratives and file-status data items, causing corruption or loss of
data, abnormal termination, and other failures. Although such calls might work in one RVU of
the software, they are not guaranteed to work in subsequent RVUs.