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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.