Use the COBOL statements shown below to process VSAM files.
START does not retrieve a record; it only sets the current record pointer.
All of the following factors determine which input and output statements you can use for a given VSAM data set:
The following table shows the possible combinations of statements and open modes for sequential files (ESDS). The X indicates that you can use a statement with the open mode shown at the top of the column.
| Access mode | COBOL statement | OPEN INPUT | OPEN OUTPUT | OPEN I-O | OPEN EXTEND |
|---|---|---|---|---|---|
| Sequential | OPEN | X | X | X | X |
| WRITE | X | X | |||
| START | |||||
| READ | X | X | |||
| REWRITE | X | ||||
| DELETE | |||||
| CLOSE | X | X | X | X |
The following table shows the possible combinations of statements and open modes you can use with indexed (KSDS) files and relative (RRDS) files. The X indicates that you can use the statement with the open mode shown at the top of the column.
| Access mode | COBOL statement | OPEN INPUT | OPEN OUTPUT | OPEN I-O | OPEN EXTEND |
|---|---|---|---|---|---|
| Sequential | OPEN | X | X | X | X |
| WRITE | X | X | |||
| START | X | X | |||
| READ | X | X | |||
| REWRITE | X | ||||
| DELETE | X | ||||
| CLOSE | X | X | X | X | |
| Random | OPEN | X | X | X | |
| WRITE | X | X | |||
| START | |||||
| READ | X | X | |||
| REWRITE | X | ||||
| DELETE | X | ||||
| CLOSE | X | X | X | ||
| Dynamic | OPEN | X | X | X | |
| WRITE | X | X | |||
| START | X | X | |||
| READ | X | X | |||
| REWRITE | X | ||||
| DELETE | X | ||||
| CLOSE | X | X | X |
The fields that you code in the FILE STATUS clause are updated by VSAM after each input-output statement to indicate the success or failure of the operation.
related concepts
File position indicator
related tasks
Opening a file (ESDS, KSDS, or RRDS)
Reading records from a VSAM file
Updating records in a VSAM file
Adding records to a VSAM file
Replacing records in a VSAM file
Deleting records from a VSAM file
Closing VSAM files
related references
File status key (Enterprise COBOL Language Reference)