Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Permissible record formats and access modes

Record formats

Sequential files may contain records of fixed length (RECFORM=F), variable length (RECFORM=V), or undefined length (RECFORM=U). However, blocking is possible only in the case of fixed- or variable-length records.

In the COBOL compilation unit, the format of records to be processed is defined in the RECORD or RECORDING MODE clause (see “COBOL2000 Reference Manual” [1]). The following table lists the phrases associated with each record format:


Record format

Phrase in the

RECORD clause

RECORDING MODE clause

Fixed-length
records

RECORD CONTAINS...CHARACTERS

(format 1)


Variable-length records

RECORD IS VARYING IN SIZE...
or
RECORD CONTAINS...TO...

(format 2)

(format 3)


Records of
undefined length

Declaration not possible with the
RECORD clause

RECORDING MODE IS U

Table 19: Specification of record formats in the RECORD or RECORDING MODE clause


If neither of the two clauses is specified, the compiler assumes that the records are of variable length.

Access modes

Records of a sequential file can only be accessed sequentially, i.e. the program can only process them in the order in which they were written to the file during its creation.

The mode of access is specified in the ACCESS MODE clause in the COBOL compilation unit. In the case of sequential files, ACCESS MODE IS SEQUENTIAL is the only admissible entry. Since this is also the default value assumed by the compiler, the ACCESS MODE clause may be omitted in this case.