From the course: Migrating COBOL Apps

Unlock the full course today

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

Introduce structure through subprograms

Introduce structure through subprograms - COBOL Tutorial

From the course: Migrating COBOL Apps

Start my 1-month free trial

Introduce structure through subprograms

- [Narrator] An important way of managing complexity in an application, is to structure the code into manageable pieces, particularly with respect to the size of an individual program. I've taken out the permute code from the desr program, and created a subprogram called permute.cob. Let's have a look at it, nano -l permute.cob. I've kept the documentation and inserted it at the top of the program. In the data division, we have the local data items, the subprogram will use. The two indexes for bit permutation, and the permutation tables. Following this at line 1921, there's a linkage section which shows the parameters we expect to receive. Here we've got the permutation size, the from and to arrays, and the permutation table to use. We also have a copy of the AC structure, on which we'll perform the permutation calculations. At line 205, we have the procedure division, which has a using clause, which shows the…

Contents