Feedback
Did this article resolve your question/issue?

   

Article

FIND CURRENT within FOR EACH fails to compile

« Go Back

Information

 
TitleFIND CURRENT within FOR EACH fails to compile
URL NameFIND-CURRENT-within-FOR-EACH-fails-to-compile
Article Number000172624
EnvironmentProduct: Progress
Version: 9.x
Product: OpenEdge
Version: 10.x, 11.0, 11.1, 11.2, 11.3
OS: All Supported Platforms
Question/Problem Description

Attempting to re-find a record using FIND CURRENT, from within a FOR EACH block for the same table, fails with error 213.
 
Steps to Reproduce
Clarifying Information

The error is intended to prevent compiling code that would attempt to change the cursor the buffer is pointing to.  However it doesn't take into account that no change is being attempted except for the LOCK type.

The below code incorrectly fails to compile:

FOR EACH Customer NO-LOCK:
  FIND CURRENT Customer EXCLUSIVE-LOCK.
END.

 
Error Message** FIND cannot be processed for a FOR EACH mode record. (213)
Defect/Enhancement NumberDefect PSC00233755/OE00207951
Cause

The compiler code encountered a FIND on the same buffer but didn't take into account that it was a FIND CURRENT.
 
Resolution

Upgrade to OpenEdge 11.4.0 or later.
 
Workaround

If using a Progress\OpenEdge release prior to 11.4.0, use one of the below coding workarounds to avoid this problem:

1) Use a named buffer:

DEFINE BUFFER bCustomer FOR Customer.

FOR EACH Customer NO-LOCK:
  FIND bCustomer WHERE ROWID(bCustomer) EQ ROWID(Customer) EXCLUSIVE-LOCK.
END.


2) Use the FIND-CURRENT method on the buffer:

FOR EACH Customer NO-LOCK:
  DO TRANSACTION:
    BUFFER Customer:FIND-CURRENT(EXCLUSIVE-LOCK).
  END.
END.

Notes
Last Modified Date5/26/2015 9:01 PM
Attachment 
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.