TomBascom
Curmudgeon
One more clarification is required, can you please let me know if PRE-SELECT statement is more powerful that FOR-EACH. Is it that PRE-SELECT statement improves performance than FOR-EACH? Correct me if I am wrong.
No, it is not "more powerful". It just gives you a different set of capabilities.
Personally, I never use PRE-SELECT. But some people find it useful. Particularly if they are planning to modify the key fields in such a way that they will see a record two or more times in the FOR EACH loop. Like this might:
Code:
/* renumber customers:
* current customers have 5 digit cust-nums and we want to
* convert to 6 digit customers that start with 1.
*/
for each customer:
cust-num = cust-num + 1000000.
end.
/* this doesn't actually work ;) */