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.
Merging records in COBOL - COBOL Tutorial
From the course: COBOL Essential Training
Merging records in COBOL
- [Instructor] In the sorting movie, we learned how to write code to sort a single input file. But what if we want to combine and sort multiple files? Well, we're in luck, since COBOL has a way to sort multiple incoming files and create one or more output files that are combined and in sorted order. This companion statement is the merge verb. It can combine the contents of multiple files together as long as the files are the same length and as long as the files all need to be sorted in a similar manner according to the same key structure. The resulting output will consist of the contents of all the input files merged together and sorted according to that key structure. Let's take a look at the flow. So once again, we have our program in the middle. In this case, mergingStudents.cbl, and for input, we have Student File 1 and Student File 2. We have a Temporary Work File because we still need to merge and sort inside the…
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.