The SOUNDEX1 routine is used to match two strings using an original Soundex algorithm.
Note: All SOUNDEX related routines are limited to working with attribute sizes of 256
characters. If the attribute length exceeds 256 characters, the algorithm will be applied
to the first 256 characters for all SOUNDEX routines. The algorithm will be applied to the
last non-blank 256 characters for all RSOUNDEX routines.
Algorithm
- Capitalize all characters in the string.
- Retain the first character of the string.
- After the first position, convert all the following characters to blank: A, E, I, O, U, H, W, Y.
- Change characters from the following sets into the corresponding digits given:
From characters | To digit |
---|---|
B, F, P, V |
1 |
C, G, J, K, Q, S, X, Z |
2 |
D, T |
3 |
L |
4 |
M, N |
5 |
R |
6 |
- Remove all consecutive pairs of duplicate digits, characters, and blanks from the string (except the first character).
- Return the string, padded with trailing zeros, if needed.
Score |
Description |
---|---|
0 |
Case 1: Both strings are blank Case 2: Neither string is blank and they are not equal. |
50 |
One string is blank; the other string is non-blank. |
100 |
Strings are equal. |