Consultor Eletrônico



Kbase P22592: How to determine whether the record is locked using a 4GL FOR EACH statement.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   16/03/2009
Status: Verified

GOAL:

How to determine whether the record is locked using a 4GL FOR EACH statement.

FACT(s) (Environment):

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

FIX:

The FOR EACH statement doesn't have the NO-ERROR option. You must use a FIND statement on a secondary buffer and use the LOCKED function to achieve what you require. e.g.

DEF BUFFER b_Cust FOR customer.
FOR EACH customer NO-LOCK:
FIND b_cust WHERE b_cust.custnum = customer.custnum
EXCLUSIVE-LOCK NO-WAIT NO-ERROR.
IF LOCKED b_cust THEN
MESSAGE "Customer record is locked." VIEW-AS ALERT-BOX.
ELSE DISPLAY CustNum Name.
END.