progress-4gl FIND basic examples


Example

A simple sports2000 example:

FIND FIRST Customer NO-LOCK WHERE CustNum = 1 NO-ERROR.
IF AVAILABLE Customer THEN DO:
    DISPLAY Customer.NAME.
END.
ELSE DO:
    MESSAGE "No record available".
END.

FIRST - find the first record that matches the query

NO-LOCK - don't lock the record - meaning we will only read and not change the record.

WHERE - this is the query

NO-ERROR - don't fail if there isn't any record available.

(IF) AVAILABLE Customer - check if we found a record or not

findLoop:
REPEAT :
    FIND NEXT Customer NO-LOCK WHERE NAME BEGINS "N" NO-ERROR.

    IF AVAILABLE customer THEN DO:
        DISPLAY Customer.NAME.
    END.
    ELSE DO:
        LEAVE findLoop.
    END.
END.