From the course: COBOL Essential Training

Unlock the full course today

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

Perform times

Perform times - COBOL Tutorial

From the course: COBOL Essential Training

Start my 1-month free trial

Perform times

- [Instructor] As we're starting to see the Perform Verb in COBOL, has many different variations. The Perform Thru allows you to perform a block of code or even another paragraph until some condition is met. A very common use of Perform Thru is for processing records in a file. The program can perform THRU a sequence of steps until the end of file is reached. Let's look at our example here. This is a carsales program and you can see on line 127 I read the first record in the carsales file. At end, I set the end of sales file variable to TRUE I've added on line 130 a check to make sure the file was not empty. So if, I encounter end of sales file right away, I'm going to stop the run. Otherwise I'm going to perform THRU, paragraph 200 through 210 which will allow me to process the sales record and read the next one, until, end of sales file is reached. Let's scroll down and take a look. You can see that process sales…

Contents