Progress
Language Tutorial
for Windows
Using the DO Block
You use the DO block to group statements together and treat them as a single unit. DO has no implicit block properties. However, you can add explicit looping and frame allocation properties to the DO block by using the syntax shown below.
Here are some common uses of the DO block:
- To group together statements within a conditional statement like IF:
- To provide explicit services to another block. For example, triggers have implicit frame allocation, but do not have the frame phrase option on the header statement. So, if the statements in your trigger operate with a frame other than one Progress expects, you can nest a DO block within the trigger block. As shown in the following code, this technique eliminates having to specify the frame on every screen-output statement in the trigger:
- To provide looping with an incrementing variable using the TO syntax as shown in this code:
- To provide conditional looping with the WHILE syntax. WHILE allows you to specify an expression. On each iteration, the block evaluates the WHILE expression and then executes the block, if the expression evaluates to TRUE. Review the WHILE expression in this code:
It’s important to note that the DO and END syntax of a trigger block does not make it a DO block. As described in this section, DO is a control structure that has no block properties unless you specify them with optional syntax. The trigger block DO has no explicit syntax options.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |