Reading data from files and writing data to files is an essential part of most COBOL programs. Your program can retrieve information, process it as you request, and then write the results.
Before the processing, however, you need to identify the files and describe their physical structure, and indicate whether they are organized as sequential, relative, indexed, or line sequential. Identifying files entails naming them and their file system. You might also want to set up a file status field that you can check later to make sure that the processing worked properly.
The major tasks you can perform in processing a file are first opening the file and then reading it, and (depending on the type of file organization and access) adding, replacing, or deleting records.
related concepts
File system
related tasks
Identifying files
Protecting against errors when opening files
Specifying a file organization and access mode
Setting up a field for file status
Describing the structure of a file in detail
Coding input and output statements for files