COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
28 Disk Input and Output
Both batch programs and transaction-supporting servers use disk files.
Common Disk File Topics
Allocation
The file system allocates physical storage for a disk file in the form of file extents. A file extent is
a contiguous block of storage, starting on a disk sector boundary and containing a multiple of
2,048 bytes (up to 134,215,680 bytes). The file system permits a disk file to have up to 978
extents—one primary extent and up to 977 secondary extents. The primary extent can be a size
different from that of the secondary extents. The file system allocates extents only when needed.
The file extents that constitute a file are not necessarily contiguous. When all extents are allocated,
writing to the file causes I-O file status code “34.”
HP COBOL has no mechanism for specifying extents. If an HP COBOL program creates a disk file,
it allocates a primary extent of 4 x 2,048 bytes and a secondary extent of 20 x 2,048 bytes. An
HP COBOL program can call the routine COBOL_CONTROL_ to allocate and deallocate extents.
If you create a disk file outside of HP COBOL and do not specify extents, the file system allocates
a primary extent of 2,048 bytes. If you do not explicitly specify a secondary extent, the file system
allocates secondary extents, as needed, that are the same size as the primary extent.
Partitioned Files
An Enscribe key–sequenced file supports up to 128 partitions; while other Enscribe disk files
supports up to 16 partitions. Every partition consists of a primary extent plus up to 977 secondary
extents. Each partition must reside on a different volume. If your system is connected to a network,
either through Expand or through the fiber optic extension (FOX) of the interprocessor bus, the
partitions can even reside on different systems (at a performance penalty). For information about
Expand, see the Expand Network Management and Troubleshooting Guide.
An HP COBOL program can read or write a partitioned file but cannot create one. You must use
FUP to create a partitioned file; for details, see the Guardian Programmer’s Guide.
Partitioned files have these significant advantages:
• They can be up to 127 times as large as non-partitioned files.
• They can be accessed faster because separate read heads are used.
• The loss of access to a disk need not mean the loss of access to the entire file.
Purging Files or Their Data
You can purge a file from the disk from your TACL session with the TACL command PURGE. An
HP COBOL program can purge a file from the disk by calling the operating system routine PURGE.
Purging a file from the disk merely removes the disk file from the directory and frees the disk space
for use by other files; it does not erase the data on the disk.
You can erase the contents of a file without purging the file with the FUP command PURGEDATA.
An HP COBOL program erases the contents of a file without purging the file simply by opening
the file for output. An HP COBOL program can erase the contents of a file by calling routine
COBOL_CONTROL_. The data remains on the disk—only the current-record, next-record, and EOF
pointers are reset, and the EOF pointer in the file label on the disk are changed to indicate that
the file is logically empty.
To erase the data on the disk, you must:
1. Use either the FUP SECURE command with its CLEARONPURGE option or call the routine
COBOL_SETMODE_ to set function 52 (see the Guardian User’s Guide).
856 Disk Input and Output










