Kbase P181494: Should records be updated within a FOR EACH ... BREAK BY loop?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/2/2011 |
|
Status: Unverified
GOAL:
Should records be updated within a FOR EACH ... BREAK BY loop?
GOAL:
Should records be deleted inside a FOR EACH ... BREAK BY block?
GOAL:
Should records be inserted within a FOR EACH ... BREAK BY block?
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Product Family
FIX:
Records should not be updated, deleted or inserted within a FOR EACH ... BREAK BY loop. BREAK implicitly sets LAST-OF and FIRST-OF at each iteration, by evaluating and comparing the current BY values with the about-to-be-read values. Therefore, it is always looking at both the current record in the selection and the next record. This occurs whether the programmer references them explicitly or not, since it is unpredictable where those references might be needed. The programmer may not be aware of these implicit references, and may not desire them. In particular, if the "next" record implicitly referenced is changed within the loop, BREAK may not operate correctly.
BREAK is intended for FORWARD-ONLY and READ-ONLY cases. Other cases may or may not work as intended based on a variety of factors. The more complex the BREAK BY expression is,the more unpredictable are the results.