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.
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 | A record can not be deleted, but its space can be reused for a same-length record. | 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.