$Sndx

From m204wiki
Jump to navigation Jump to search

The $SNDX function returns the SOUNDEX code of an argument. The $SNDX function is commonly used with files containing unusual or frequently misspelled names. You can create a field containing the SOUNDEX code for a name and then use that field for retrievals.

The code is derived in the following manner:

  1. All consecutive occurrences of the same letter are reduced to a single occurrence.
  2. The first character of the string becomes the first character of the result.
  3. All vowels, special characters, and the letters H, W, and Y are eliminated. The rest of the characters are transformed as follows:
Character(s) Change to...
B, F, P, V 1
C, G, J, K, Q, S, X, Z 2
D, T 3
L 4
M, N 5
R 6
  1. SOUNDEX code assigns numbers to the next three consonants of the word following the number assignments shown in the previous table, but disregards any remaining consonants. The Model 204 $SNDX function continues to assign numbers to all consonants.

Example 1

$SNDX('MURRAY') equals M6 $SNDX('MARY') equals M6 $SNDX('O"MALLEY') equals O54

Example 2

BEGIN %A = $SNDX($READ('ENTER NAME')) FIND.RECS: FIND ALL RECORDS FOR WHICH NAME SOUND = %A END FIND . . .