The table below shows the statements that you can use in the PROCEDURE DIVISION for sequential, line-sequential, indexed, and relative files.
| Access method | Sequential | Line sequential | Indexed | Relative |
|---|---|---|---|---|
| ACCESS IS SEQUENTIAL | OPEN EXTEND
WRITE CLOSE or OPEN I-O READ REWRITE CLOSE |
OPEN EXTEND
WRITE CLOSE |
OPEN EXTEND
WRITE CLOSE or OPEN I-O READ REWRITE DELETE CLOSE |
OPEN EXTEND
WRITE CLOSE or OPEN I-O READ REWRITE DELETE CLOSE |
| ACCESS IS RANDOM | Not applicable | Not applicable | OPEN I-O
READ WRITE REWRITE DELETE CLOSE |
OPEN I-O
READ WRITE REWRITE DELETE CLOSE |
| ACCESS IS DYNAMIC (sequential processing) | Not applicable | Not applicable | OPEN I-O
READ NEXT READ PREVIOUS START CLOSE |
OPEN I-O
READ NEXT READ PREVIOUS START CLOSE |
| ACCESS IS DYNAMIC (random processing) | Not applicable | Not applicable | OPEN I-O
READ WRITE REWRITE DELETE CLOSE |
OPEN I-O
READ WRITE REWRITE DELETE CLOSE |
related concepts
File organization and access mode
related tasks
Opening a file
Reading records from a file
Adding records to a file
Replacing records in a file
Deleting records from a file
related references
Statements used when writing records to a file