COBOL Manual for TNS/E Programs (H06.03+)
Disk Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
28-37
Optimizing Disk File Storage
To open a partitioned file when some partitions cannot be accessed, an HP COBOL
program must use the routine COBOL_SPECIAL_OPEN_. If all partitions can be
accessed, an HP COBOL program can open a partitioned file with the OPEN
statement.
For more information about partitioned files, see Partitioned Files.
Optimizing Disk File Storage
You can specify at file creation time that an indexed or data file is to be compressed for
more space-efficient storage at a slight expense of speed. Enscribe compresses
records by eliminating duplicate leading characters from one record to the next and
replacing them with a one-byte count of the duplicate characters. If a file has a
significant amount of duplicated data, the storage saving can be substantial.
The prime key of a compressed file must be at the beginning of the record.
Compression is recommended for an indexed file in which the first records of
successive blocks have similar prime-key values. Compression is recommended for an
alternate-key file in which several alternate keys have the same value.
For more information about compressing indexed and data files, see the Guardian
Programmer’s Guide.
Avoiding Deadlock
Deadlock is a situation in which two processes are in contention for a single-user
resource. If both processes require exclusive use of both resources, they are
deadlocked. Neither can proceed until the other surrenders control of the resource it
has under its control. If two servers get into a deadlock, their respective requesters are
also deadlocked because neither requester receives a reply from its server.
One example of deadlock is when one process has opened a file (call it ABLE) and
needs to open another file (call it BAKER), while another process has opened BAKER
and now needs to open ABLE.
Another example of deadlock is when one process has locked a record in a file (call it
record n ) and wants to read another record in the file (call it record m ), while some
other process has locked record m and wants to read record n.
The ways to avoid deadlock are:
•
Locking and Unlocking Files and Records
•
Setting Time Limits on Input-Output Operations










