Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : AVAILABLE function
 

AVAILABLE function

Returns a TRUE value if the record buffer you name contains a record and returns a FALSE value if the record buffer is empty.
When you use the FIND statement or the FOR EACH statement to find a record, the AVM reads that record from the database into a record buffer. This record buffer has the same name as the file used by the FIND or FOR EACH statement, unless you specify otherwise. The CREATE statement creates a new record in a record buffer.

Syntax

AVAILABLE record
record
The name of the record buffer you want to check.
Note: To access a record in a table defined for multiple databases, you might have to qualify the record's table name with the database name. See the Record phrase reference entry for more information.

Example

In this procedure, the FIND statement with the NO-ERROR option bypasses the default error checking and does not display the message you get. Because ItemNum is unique, you do not have to use the AMBIGUOUS function to pinpoint the cause of a record not being AVAILABLE.
r-avail.p
REPEAT:
PROMPT-FOR Item.ItemNum.
FIND Item USING ItemNum NO-ERROR.
IF AVAILABLE Item THEN
    DISPLAY Item.ItemName Item.Price.
ELSE
    MESSAGE "Not found".
END.

See also

AMBIGUOUS function, FIND statement, FOR statement, LOCKED function, NEW function (record buffers)