COBOL Manual for TNS/E Programs (H06.03+)

Data Fundamentals
HP COBOL Manual for TNS/E Programs520347-003
4-4
Records
Topics:
Physical Records and Logical Records
Record Elements
Record Length
Physical Records and Logical Records
COBOL programs manipulate physical records and logical records. A physical record
is a physical unit of information whose size and recording mode is convenient to a
particular computer for the storage of data on an input or output device (such as 80
characters for a terminal or 132 characters for a printer). The size of a physical record
is hardware dependent and bears no direct relationship to the size of the file of
information contained on a device. A physical record can contain one or several logical
records, or a logical record can span several physical records.
A logical record is a group of related information, uniquely identifiable, and handled as
a unit. The number of logical records that can exist in a file is a characteristic of its
supporting storage medium, possibly modified by instructions presented to the file
system during the file’s creation. The logical records of a file have either a fixed size or
a size that varies between a maximum and minimum size, depending on record type.
A logical record is defined by a set of data description entries. Each entry has a level-
number followed by a data-name and possibly a series of independent clauses. The
level-numbers form a structure, dividing a record into smaller and smaller parts.
The concept of logical records also applies to data outside files. You can group data
into logical records in all sections of the Data Division.
Once you describe the relationship between logical records and physical records,
record manipulation is the responsibility of the HP COBOL or CRE run-time routines
and the NonStop operating system.
Note. In this manual, “record” means logical record unless “physical record” is specified.
Example 4-2. Logical Record
01 BIBLIOGRAPHY-RECORD.
03 AUTHOR-NAME.
05 LAST-NAME PICTURE X(20).
05 FIRST-NAME PICTURE X(20).
03 TITLE PICTURE X(50).
03 PUBLICATION-INFO.
05 PUBLISHER.
07 PUB-NAME PICTURE X(20).
07 PUB-LOCATION PICTURE X(20).
05 PUBLICATION-YEAR PICTURE 9999.