File organization and access mode

You can organize your files as sequential, line-sequential, indexed, or relative. The access mode defines how COBOL reads and writes files, but not how files are organized.

You should decide on the file organization and access modes when you design your program.

The following table summarizes file organization and access modes for COBOL files.

Table 1. File organization and access mode
File organization Order of records Records can be deleted or replaced? Access mode
Sequential Order in which they were written A record cannot be deleted, but its space can be reused for a same-length record. Sequential only
Line-sequential Order in which they were written No Sequential only
Indexed Collating sequence by key field Yes Sequential, random, or dynamic
Relative Order of relative record numbers Yes Sequential, random, or dynamic

Your file-management system handles the input and output requests and record retrieval from the input-output devices.

related concepts  
Sequential file organization  
Line-sequential file organization  
Indexed file organization  
Relative file organization  
Sequential access  
Random access  
Dynamic access

related tasks  
Specifying a file organization and access mode