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.
Reading sequential files - COBOL Tutorial
From the course: COBOL Essential Training
Reading sequential files
- [Instructor] Reading files with a sequential organization is probably the most common access method for COBOL programs. These types of files can be read as input, they can be used for output or even IO. I have open an example program called employee.CBL that is located in the Exercise Files folder under chapter four. This program is designed to read an employee file, keep a running total of all the salaries and write a report of the employees and the total salary. To read the file, we must start in the Environment Division. In my program, my Environment Division starts on line four. Next, we have the input output section, followed by the file control. As you can see in the example, I have declared a select statement to assign the file name that will be used in the COBOL program, Employee File, to the file name on my computer. In this case, EMPFILE.DAT. The EMPFILE.DAT is located in the same directory as my COBOL program.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.