The SOUNDEX() function returns a four character string determined by the phonetic content of a string. The SOUNDEXS() function is similar to SOUNDEX() but operates on successive elements of a dynamic array, returning a similarly structured dynamic array of results.
The SOUNDEX() function is useful for situations where it is desired to compare or locate items by their spoken sound. For example, names in a telephone directory could be indexed by their SOUNDEX() value to aid location of similar sounding names.
The value returned by SOUNDEX() is made up from the first letter of string in upper case followed by three digits which are found by examination of further characters of string according to the following table.
Non-alphabetic characters and letters in group 0 are ignored. Consecutive occurrences of the same letter insert only a single character. If the result is less than four characters long, zeros are added to fill the remaining positions. Thus the word SOUNDEX encodes to S532.
On ECS mode systems, the Soundex algorithm is based only on the letters A to Z, upper and lower case. The character maps do not affect this function.
DISPLAY "Enter name "
KEY = SOUNDEX(NAME)
READ OTHER.NAMES FROM PHONONYMS, KEY THEN
NAME = OTHER.NAMES
This program fragment prompts for and reads a name. It then establishes the soundex key for this name and attempts to read a list of similar sounding names from the PHONONYMS file. If found, this list replaces the NAME value.