From the course: COBOL Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Direct access files in COBOL

Direct access files in COBOL - COBOL Tutorial

From the course: COBOL Essential Training

Start my 1-month free trial

Direct access files in COBOL

- [Instructor] So far, all of our programs have been written using sequential files. When a program needs to process, all the records in a file, this is our best choice. But the main drawback is when you have to insert delete, amend, or even update a record because a whole new file must be created. This makes sequential files not efficient when access is needed to only a few records. For example, if 10 records are to be inserted into a 10,000 record file, then all 10,000 records will have to be read from the old file. And 10,010 records will be have to be written to the new file. This really increases the time to insert a new record. But lucky for us, COBOL has something called direct access files. There are two types of direct access files, they include, relative and indexed. When working with relative access files, we use relative records, which are organized by ascending relative record number. For the indexed…

Contents