home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
disk_20.zip
/
SOUNDEX2.ZIP
/
PROCSDX.PRG
next >
Wrap
Text File
|
1987-03-21
|
3KB
|
82 lines
*:*********************************************************************
*:
*: Program: PROCSDX.PRG
*:
*: System: soundex
*: Author: Larry
*: Copyright (c) 1986, Larry
*:
*: Called by: TEST.PRG
*:
*: Documented: 3/21/87 23:41 SNAP! version 1.73
*:*********************************************************************
PROCEDURE cnvrt_sdx
PARAMETERS sdxin , sdxout
** The original soundex a dbaseii program and was found on the
** Lakewood police bulletin board in Denver under the file name
** of pen-toll and apparently written by someone named Larry .
** Hats off to Larry.
** The original code was converted to dbaseiii+ had a few bugs taken
** out and some enhancements added by Hank Jones.
**
** This SOUNDEX algorithm will convert any string into a phonetic code
** the resulting code will be the same for 'sound alike' words
** (usually last names ).
** example : smith and smythe both convert to S53
**
** this version of soundex does not strictly adhere to the Rand
** definition , the following exceptions are noted.
** 1) special characters are coded as 2
** oleary codes to O46 , o'leary codes to O246
** newton codes to N35 , newton-john codes to N3525
** 2) lower case input and the resulting code will be upshifted.
** 3) The resulting codes are variable length .
** in the rand soundex jones would code J520 or skywalker S242
** (first character of the string plus three digits right padded
** with zero).In this application jones would code J52
** or skywalker would code S2426.
**
** parameters
** INPUT IS SDXIN
** OUTPUT IS SDXOUT
**
STORE TRIM(UPPER(sdxin))+ " " TO in_name
STOR LEN(TRIM(in_name)) TO name_lgth
STOR SUBSTR(in_name,1,1) TO sdx_code,dup_check
STOR 2 TO indx
STOR SUBSTR(in_name,indx,1) TO current
DO WHILE indx <= name_lgth
DO CASE
CASE current='A'.or.current='E'.or.current='H'.or.current='I';
.OR. current='O'.or.current='U'.or.current='W'.or.current='Y'
STORE '0' TO current
CASE current='B'.or.current='F'.or.current='P'.or.current='V'
STORE '1' TO current
CASE current='D'.or.current='T'
STOR '3' TO current
CASE current='L'
STOR '4' TO current
CASE current='M'.or.current='N'
STOR '5' TO current
CASE current='R'
STOR '6' TO current
OTHERWISE
STOR '2' TO current
ENDCASE
IF (current<>'0'.AND. current<>dup_check)
STORE sdx_code+current TO sdx_code
STORE current TO dup_check
ENDIF
*SET STEP ON
*SET ECHO ON
indx = indx + 1
STORE SUBSTR(in_name,indx,1) TO current
ENDDO
sdxout = sdx_code
RETURN
*: EOF: PROCSDX.PRG