ILE COBOL Language Reference

Relationship Between Data Organizations and Access Modes

Sequential Files

Files with sequential organization are accessed sequentially. The sequence in which records are accessed is the order in which the records were originally written.

Relative Files

All three access modes are allowed.

In the sequential access mode, the sequence in which records are accessed is the ascending order of the relative record numbers of all records that currently exist within the file.

In the random access mode, you control the sequence in which records are accessed. The desired record is accessed by placing its relative record number in a RELATIVE KEY data item; the RELATIVE KEY must not be defined within the record description entry for this file.

In the dynamic access mode, you may change from sequential access to random access, using the appropriate forms of input-output statements.

Indexed Files

All three access modes are allowed.

In the sequential access mode, the sequence in which records are accessed is determined by the prime record key value. Records having the same duplicate value in an alternate record key which is the key of reference are made available in the same order in which they were released by execution of WRITE statements, or REWRITE statements which create such duplicate values.

In the random access mode, you control the sequence in which records are accessed. The desired record is accessed by placing the value of its record key in the RECORD KEY data item. If a set of records has alternate record key values, only the first record written is available.

In the dynamic access mode, you may change from sequential access to random access, using appropriate forms of input-output statements.

+-------------------------------IBM Extension--------------------------------+

Transaction Files

See the Transaction Files chapter in the ILE COBOL for AS/400 Programmer's Guide for a discussion of access mode considerations for transaction files.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]