COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-39
Using Enscribe and Operating System Routines
Suppose you have a file declared by these entries:
SELECT OAK-FILE ASSIGN TO "$OAK.ACORN.TREE"
ORGANIZATION IS SEQUENTIAL
ACCESS MODE IS SEQUENTIAL
FILE STATUS IS OAK-STATUS.
FD OAK-FILE
LABEL RECORDS ARE OMITTED.
01 OAK-RECORD.
02 ...
Suppose that you open the file with this statement:
OPEN INPUT OAK-FILE WITH TIME LIMITS SHARED.
Suppose that your program includes a declaratives section such as:
DECLARATIVES.
OAK-FILE-USE-SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON OAK-FILE.
OAK-DECL.
IF OAK-STATUS = "30"
AND GUARDIAN-ERR = 40
MOVE "Operation timed out on OAK file" TO REPORT
MOVE TIME-OUT-CODE TO OAK-ERROR
DISPLAY REPORT
END-IF.
END DECLARATIVES.
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.










