Previous Topic: &DELAY

Next Topic: &DOEND


&DO

&DO groups a sequence of NCL statements together to form a logical program function block.

The group is delimited by a &DOEND statement.

An &DO group is usually executed after an &IF or &ELSE statement, but is coded anywhere in a procedure to help structure your code. There is no limit to the nesting levels of &DO constructions.

The main advantage of &DO grouping is to allow the use of structured programming techniques and thereby minimize or eliminate the use of multiple &GOTO statements.

Examples: &DO

&IF &DAY = WED &THEN +
 &DO
 -*  
 -* Other NCL statements
 -*
 &DOEND
&ELSE +
 &DO
 -*  
 -* Other NCL statements
 -*
 &DOEND

&DO groups must be terminated by an &DOEND statement, that is, &DO and &DOEND statements must be paired. Unbalanced pairs cause syntax errors at load time.

More information:

&DOWHILE

&DOUNTIL