Do statement best practice

jgitter

New Member
I am new to Progress. We use Progress v9.1D. I hope this is simple (maybe even stupid) question but, I am responsible to writing and modifying reporting apps. I have noticed that these apps make extensive use of the Progress "DO" statement. Even in a simple if/then statement the DO statement is used to enclose several statements. I am from a Windows development environment (VB, C#). It sure seems like the DO statement is being overused. Is there a best practice for using the DO statement in a Progress program?
 
Progress is block stuctured i.e. letting you group together parts of your procedures into blocks.

DO: is a block statement. It starts a block by default.
IMHO there should be an overhead attached with that (although very small).
Have a look at programing handbook, there is a chapter on block scoping, that should get you started.

I would say, if statements are not to be grouped then don't use it.

-Parul.

 
DO is used to have a group of statements execute where one would otherwise have only a single statement. E.g.

IF x
THEN something.

requires no DO, but

IF x
THEN DO:
something
something else
and yet something more
END.

requires the DO.

Note also that there are a number of optional properties of DO blocks besides this basic one, so some reading of the manuals is in order.
 
Back
Top