$Reverse: Difference between revisions
(Automatically generated page update) |
|
(No difference)
|
Revision as of 14:22, 29 July 2014
The $REVERSE function reverses the order of a string.
Syntax
The format of the $REVERSE function is:
$REVERSE(string)
where string is any character string.
For example:
PRINT $REVERSE('AB CDEF')
prints the value FEDC BA.
$REVERSE is particularly useful when the file manager defines an ORDERED field to contain the characters of a frequently retrieved field in reverse order. Thus, when leading wildcard patterns (for example, *SON) are used to retrieve records or values, the patterns can be reversed to optimize the ordered retrieval. If the patterns remain in leading wildcard form and the original, unreversed field is used to retrieve values or records, the entire Ordered Index is searched to find the values satisfying the pattern.
For example, an ORDERED field named WORD exists and values ending in LY are to be retrieved frequently. To optimize this retrieval, another ORDERED field named REVERSE.WORD can be defined to store the reversed values in the WORD field, and the pattern *LY can be reversed to retrieve values in REVERSE.WORD LIKE 'YL*'. The pattern YL* optimizes the Ordered Index retrieval, providing much faster performance than *LY.
For more information on defining fields to optimize leading wildcard patterns, refer to the Rocket Model 204 File Manager's Guide.