Consultor Eletrônico



Kbase P73777: 4GL/ABL: How to limit the scope of a buffer?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/11/2008
Status: Verified

GOAL:

4GL/ABL: How to limit the scope of a buffer?

GOAL:

How to limit the scope of a record using an internal procedure/function/method?

GOAL:

How to limit the scope of a record using a DO FOR block?

GOAL:

What is record Scoping in Progress/OpenEdge?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

When Progress reads a record from the database, it stores that record in a record buffer. The scope of the record is the portion of the procedure where that record buffer is active. Record scope determines when Progress clears the record from the buffer, when it writes the record to the database, and how long a record lock is in effect. The following code snippets demonstrate two ways of limiting the scope of the record:
1. Define the buffer in an internal procedure/function/method to limit its scope to that internal procedure/function/method. For example:
PROCEDURE LimitBufferScope:
DEFINE BUFFER customer FOR customer.
FIND LAST Customer EXCLUSIVE-LOCK.
/* do the record processing here */
END PROCEDURE.
2. Use the DO FOR block to limit the buffer scope to that block. For example:
DO FOR Customer:
DO TRANSACTION:
FIND FIRST Customer EXCLUSIVE-LOCK.
/* do the record processing here */
END.
RELEASE Customer.
END.