Try OpenEdge Now
skip to main content
DataServer for Microsoft SQL Server
Additional Features to Enhance DataServer Performance : Replacing FIND FIRST for performance

Replacing FIND FIRST for performance

When coding ABL applications for the DataServer, FIND FIRST statements can often be replaced with other ABL statements to greatly improve performance. OPEN QUERYs and dynamic FINDs are significantly more efficient. Likewise, using FOR FIRST in place of FIND FIRST can improve performance when retrieving a single record with NO-LOCK. For example, if your application uses the following FIND FIRST code:
FIND FIRST tablename WHERE where-clause NO-LOCK.
The code can be replaced with the following for significant performance gains:
FOR FIRST tablename WHERE where-clause NO-LOCK:
In the case of the FOR FIRST, the record is not reliably available beyond the end of the FOR FIRST loop unless a LEAVE is specified. Similar performance advantages can be gained when retrieving last record as well.