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

KEYWORD function

Returns a character value that indicates whether a string is an ABL reserved keyword.

Syntax

KEYWORD ( expression )
expression
A constant, field name, variable name, or expression that results in a character string. If expression matches an ABL reserved keyword or valid abbreviation of a reserved keyword, the KEYWORD function returns the full keyword. If there is no match, the KEYWORD function returns the Unknown value (?).
In some cases, the abbreviation for a keyword is also a keyword. For example, if expression is "def" (the abbreviation for DEFINE) or "col" (the abbreviation for COLUMN), the KEYWORD function returns the values "def" and "col", respectively.
If you use the Run-time client, the KEYWORD function always returns the Unknown value (?).

Example

In this example, the KEYWORD function tests the value of formname. If the user tries to use a reserved word as a form name, the AVM displays a message to try again.
r-keywd.p
DEFINE VARIABLE formname AS CHARACTER NO-UNDO FORMAT "x(20)".

REPEAT ON ERROR UNDO, RETRY:
UPDATE formname.
IF KEYWORD(formname) NE ? THEN DO:
MESSAGE formname + " may not be used as a form name".
UNDO, RETRY.
END.
ELSE LEAVE.
END.

Notes

*Because KEYWORD recognizes abbreviations, it does not distinguish between FORM and FORMAT or between ACCUM and ACCUMULATE.
*This function returns the Unknown value (?) for colors and most data types, as well as all unreserved keywords. See the Keyword Index for a list of ABL reserved and unreserved keywords.
*KEYWORD is less restrictive than the KEYWORD-ALL function. Use this function if you do not want to use ABL reserved keywords as field names, for example.
*For SpeedScript, all ABL reserved keywords are also reserved for SpeedScript.

See also

KEYWORD-ALL function