In a COBOL application, you are tasked with processing inventory items. Each item has a varying quantity that you need to update. Which type of PERFORM loop should you use, and how would you implement it?

  • PERFORM THRU loop
  • PERFORM UNTIL loop
  • PERFORM VARYING loop
  • PERFORM WITH TEST BEFORE loop
A PERFORM VARYING loop would be appropriate for processing inventory items with varying quantities. This loop type is useful when you need to iterate over a range of values. In this case, you can use it to iterate through the inventory items, updating the quantity for each item in the loop body.
Add your answer
Loading...

Leave a comment

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