COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
Table 24 Descriptions of File-Control Entry Clauses (continued)
DescriptionClause
in a file description entry or sort-merge file description entry must also be in a SELECT
clause.
Associates the file name used within the program with an operating system file. The
operating system file name is the one the operating system uses to refer to the file.
ASSIGN
Specifies the logical structure of a file, which was established when the file was
created and which you cannot change. The default is sequential organization.
ORGANIZATION
Specifies the method of determining the length of a variable-length record on the
file’s physical medium. It can appear only for a sequential file whose description
RECORD DELIMITER
specifies variable-length records. HP COBOL handles the RECORD DELIMITER clause
as a comment.
Specifies the order in which a process can read records from the file.ACCESS
The default is sequential access.When the access mode is sequential, a process can
read records from or write records to the file one after the other, in an order that
depends on the file’s organization (see Table 25).
When the access mode is random, you use key values to specify the order in which
a process reads or writes records. The file-control entry specifies a data item to hold
a key value (see Table 26).When the access mode is dynamic, records can be
processed either sequentially or randomly.
See the paragraphs after Table 26.ALTERNATE RECORD KEY
The FILE STATUS clause specifies the identifier (designated in the syntax as filestat
) that is to serve as the file-status data item for the file. When a COBOL run-time I-O
FILE STATUS
routine completes an operation on the file, it stores the status code in the file-status
data item before returning control to your program.
The identifier filestat must reference an alphanumeric data item with a size of
exactly two characters. The data item must be defined in the Working-Storage Section,
Extended-Storage Section, or Linkage Section of the Data Division.
Table 25 Sequential Access
Records are read by ascending alternate key or processed in the order …File Organization
that they are written, from the first physical record to the lastSequential, Line sequential
of ascending relative record numbersRelative
of ascending record key values within a given keyIndexed
Table 26 Random Access
Next record to be processed is determined by the value of …File Organization
RELATIVE KEY or ALTERNATE RECORD KEY data itemRelative
RECORD KEY or ALTERNATE RECORD KEY data itemIndexed
The ALTERNATE RECORD KEY clause specifies an alternate record key (designated in the syntax
as altkey ) for the file. Each altkey must reference an alphanumeric or unsigned numeric data
item defined in a record description entry associated with its file name. In either case, the collating
sequence is ASCII—using tricks to allow altkey to be a signed numeric data item causes problems.
An altkey cannot reference an item whose size is variable. The presence or absence of the
DUPLICATES phrase specifies whether or not the value of this alternate record key can be duplicated
among the records in the file.
If more than one record in a file has the same alternate record key value then when a program
reads the file according to the alternate record key, the records are presented to the program either
in either prime record key order or in the chronological order of their insertion into the file. The
Input-Output Section 117










