Looping

We will now cover some of the looping logic in cobol. One thing I’ll mention before we get into it: We can name parts of the procedure division; these named parts, called paragraphs, can be used kind of similarly to functions or named lambda functions in python. In cobol a paragraph can contain many sentences/statements.

So I think the loops are pretty well explained above. You will notice here we set aside code to be called outside the procedure division. This is because we want to define these as things we can do but we don’t actually want to run them in the procedure division so we put them in paragraphs outside the procedure division. To do this each one needs to have a name that we can reference/use in the procedure division. So B-PARA-TIMES will only be run when its called in our loop on line 13.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *