Chapter 4. Using Flow of Control Statements

In this chapter, you will learn how to

  • Use the compound statement

  • Use labels in both compound statements and loops

  • Work with the two conditional statements (IF and CASE)

  • Implement the four looping statements (FOR, WHILE, REPEAT, and LOOP)

  • Implement the four transfer of control statements (GOTO, LEAVE, ITERATE, and RETURN)

Sequential execution is the most basic path that program execution can take. With this method, the program starts execution at the first line of the code, followed by the next, and continues until the final statement in the code has been executed. This approach works fine for very simple tasks but tends to lack usefulness because it can only handle one situation. Programs often need to be ...

Get DB2® SQL PL: Essential Guide for DB2® UDB on Linux™, UNIX®, Windows®, i5/OS™, and z/OS®, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.