---
title: "COBOL READ NEXT – How to Code Correctly Unlock now"
description: "INDEXED files cam be access in 3 ways (Refer previous post). There are key difference on the options especially how they support differenct file options. Below is the complete list file options."
url: https://srinimf.com/2016/03/17/indexed-files/
date: 2016-03-17
modified: 2026-10-10
author: "Srini"
image: https://i0.wp.com/srinimf.com/wp-content/uploads/2016/03/pexels-photo-572056.jpeg?fit=1880%2C1254&ssl=1
categories: ["COBOL"]
tags: ["COBOL Files", "COBOL Tips and Tricks"]
type: post
lang: en
---

# COBOL READ NEXT – How to Code Correctly Unlock now

In COBOL the [indexed files](https://srinimf.com/2017/03/21/how-to-read-indexed-file-syntax/) you can be accessed in 3 ways (Refer [previous](https://srinimf.com/2016/03/16/3-ways-reading-vsam-files-with-start-and-read-next/)post). There are few key differences on the options especially in the access modes. Below is the complete list of file access mode options for indexed files.

## READ NEXT in COBOL

You can have any one of the below 3 access modes for Indexed files. The files, which you are defined as sequential, then can read only in sequential way.

The records you defined for Random access – You can access in any order how you defined. Example – RECORD KEY, ALTERNATE KEY or RELATIVE KEY

The files defined with Dynamic access modes, then it can be accessed Sequential or Random way.

**SEQUENTIAL Access supports the following file manipulation options**

- DELETEREADREWRITESTARTWRITEUNLOCK

**RANDOM Access supports the following options**

- DELETE
- START
- READ
- REWRITE
- WRITE
- UNLOCK

**DYNAMIC Access supports the following options**

- DELETE
- READ
- READ NEXT
- REWRITE
- START
- WRITE
- UNLOCK

> Tip:START and READ NEXT highly useful for Random and Dynamic access modes.The START will position the record:

```
START file-name 
KEY IS EQUAL TO ALTERNATE-RECORD-KEY.
READ file_name
NEXT RECORD INTO identifier.
```

Among the above options “READ NEXT” differentiates out of all. Since for random reading “READ” alone is not enough. If you want sequential reading of INDEXED file,  then you need “READ NEXT” option.

So, the next record you can read sequentially with ‘READ NEXT’ statement.

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2016%2F03%2F17%2Findexed-files%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2016%2F03%2Fpexels-photo-572056.jpeg%3Ffit%3D1200%252C800%26ssl%3D1&description=COBOL%20READ%20NEXT%20-%20How%20to%20Code%20Correctly%20Unlock%20now)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2016/03/17/indexed-files/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2016/03/17/indexed-files/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2016/03/17/indexed-files/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2016/03/17/indexed-files/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20COBOL%20READ%20NEXT%20-%20How%20to%20Code%20Correctly%20Unlock%20now&body=https%3A%2F%2Fsrinimf.com%2F2016%2F03%2F17%2Findexed-files%2F&share=email)
-

### Like this:

Like Loading…
