Try OpenEdge Now
skip to main content
ABL Essentials
Record Buffers and Record Scope : Record scope : Weak-scoped blocks and free references
 

Weak-scoped blocks and free references

Record Buffer Rule 3: A weak-scope block cannot contain any free references to the same buffer.

This rule makes sense for the same reasons as Record Buffer Rule 2. Consider this example:
DEFINE VARIABLE fLimit AS DECIMAL     NO-UNDO.

FOR EACH Customer NO-LOCK WHERE Customer.State = "NH"
  BY Customer.CreditLimit DESCENDING:
  DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit.
  fLimit = Customer.CreditLimit.

  FIND FIRST Customer NO-LOCK WHERE Customer.CreditLimit > fLimit.
  DISPLAY Customer.CustNum Customer.Name Customer.CreditLimit.
END.
While the AVM is processing the FOR EACH block, it gets a request to use the same buffer to find a completely unrelated record. This fails with a similar error, as shown in the following figure.
Figure 30. FOR EACH processing error message