Procedure Blocks and Data Access

In the first three sections of this book, you learn about the basic structure of ABL and many of its language constructs. This section returns you to writing ABL procedures on your own. These procedures contain some business logic that demonstrates in detail a few of the concepts touched on in the previous sections.

The important concepts of this section are ones you have already seen in action and learned something about. Indeed, as discussed with the very simplest ABL procedure—FOR EACH Customer: DISPLAY Customer.—you can hardly write any ABL code at all without defining blocks and using data access statements.

Nonetheless, this section goes into a lot more detail in these areas so that you have a more thorough understanding of these basic building blocks of ABL procedures. This section describes:

  • All the basic syntax for defining blocks of various kinds in the language, including some that iterate through a set of statements and some that just group them as a common action
  • The scoping of blocks and of the variables and objects you define in them and how scoping affects the way your procedures behave
  • A variety of ways to access database data and integrate it into your procedures

Blocks and block properties

You saw several different kinds of blocks in the example procedures from the first two chapters. To review them:

  • Every procedure itself constitutes a block, even just the simplest RUN statement executed from an editor window.
  • Every call to another procedure, whether internal or external, starts another block. An external procedure can contain one or more internal procedures, each of which forms its own block.
  • ABL statements such as FOR EACH and DO define the start of a new block.
  • A trigger is a block of its own.