COBOL Manual for TNS and TNS/R Programs
Disk Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
28-10
Structured Files
A program written entirely in HP COBOL can open unstructured files that are not in
EDIT format for input or output, but cannot create an unstructured file.
To use an existing unstructured file, your HP COBOL program must declare it:
•
With ORGANIZATION SEQUENTIAL
•
With ACCESS MODE SEQUENTIAL
•
With fixed-length records (if the file is not an EDIT file)
•
Without alternate keys
When using an unstructured file, an HP COBOL program still operates on the basis of
records, but they are strictly logical records. If one HP COBOL program writes an
unstructured file of 80-character records, another program can read it with any record
length. If the reading program expects 37-character records, the run-time routines
deliver 37-byte pieces of the continuous byte stream. You can rewrite a record with
another record of the same length, but you cannot delete a record.
The HP COBOL run-time routines that access unstructured disk files manage those
files directly. An unstructured file has no records, as far as Enscribe is concerned; the
declarations in your HP COBOL program determine how the HP COBOL run-time
routines manipulate the unstructured files.
Structured Files
Structured disk files are either entry-sequenced, relative, or key-sequenced.
The HP COBOL run-time routines that access structured disk files (entry-sequenced,
relative, and key-sequenced) do so with the help of the operating system routines that
are collectively called the Enscribe database record manager.
Table 28-3. Corresponding HP and HP COBOL Disk File Terms
HP Term HP COBOL Term
Relative Relative
Entry-sequenced Sequential
Key-sequenced Indexed