Sie sind auf Seite 1von 5

SOUNDEX.

EXE - A SOUNDEX CALCULATOR


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=SOUNDEX.EXE is a TSR (Terminate and Stay Resident) program that
calculates SOUNDEX codes from data entered at the keyboard. As
it is a TSR program it can be loaded and popped-up over other
programs such as ENTER. This allows you to add SOUNDEX support
to your data-entry systems.
Once loaded, SOUNDEX.EXE takes about 4.5KB or memory. To load
SOUNDEX.EXE type:
SOUNDEX
At the MSDOS prompt. To activate or 'pop-up' SOUNDEX.EXE hold
down the <Alt> key and press the <S> key. You can also load
SOUNDEX from within a DOS batch file or an EpiGlue .MNU file.
For example:
EnterHIVData
BEGIN
SOUNDEX
ENTER D_HIV
END
If memory is tight you may use the MARK and REMOVE programs
that are also distributed with EpiInfo to unload SOUNDEX.EXE
from memory after use. For example:
EnterHIVData
BEGIN
MARK > NUL
SOUNDEX
ENTER D_HIV
REMOVE > NUL
END
SOUNDEX.EXE creates two temporary 'swap' files (SOUNDEX.000 and
SOUNDEX.001) of about 58KB in length each time it is loaded. If
disk space is tight you may delete these files after SOUNDEX
has been unloaded from memory. For example:
EnterHIVData
BEGIN
MARK > NUL
SOUNDEX
ENTER D_HIV
REMOVE > NUL
DEL SOUNDEX.000
DEL SOUNDEX.001
END
SOUNDEX.EXE in operation
=-=-=-=-=-=-=-=-=-=-=-=Once you have loaded SOUNDEX.EXE it can be popped up over any
MSDOS application by typing <Alt> + <S> (hold down the <Alt>
key and press the <S> key). A small box will appear in the

middle of the screen:


+---------------------------------------+
| Surname: ____________ Soundex: _____ |
+---------------------------------------+
To calculate a SOUNDEX code type the surname for which a
SOUNDEX code is required (e.g. Anteater) and press the <Enter>
key. The SOUNDEX code will be calculated and displayed:
+---------------------------------------+
| Surname: ANTEATER
Soundex: A-533 |
+---------------------------------------+
Press the <Enter> key if you want to calculate another SOUNDEX
code or the <Esc> key to return to you application. Note that
any spaces or punctuation characters that you type are ignored
as these are irrelevant to the Soundex coding rules.
Why use Soundex coding?
=-=-=-=-=-=-=-=-=-=-=-=
The use of Soundex code provides an alternative to supplying
surnames when confidentiality is required. This system is used
by CDSC (the UK equivalent of CDC) for the HIV / AIDS Voluntary
Confidential Reporting Schemes. Confidentiality is ensured as
no Soundex code is unique to a single surname. If the code is
used in combination with date of birth duplicate records can be
detected. This makes it possible to share confidential data
about (e.g.) sexually transmitted infections without using
names. Soundex coding is well suited to public health
surveillance of disease.
The Soundex coding rules
-=-=-=-=-=-=-=-=-=-=-=-=
SOUNDEX is a substitution code based on the following rules:
The first letter of the surname is always retained. The rest
of the surname is compressed to a three digit code based on the
following coding scheme:
A
B
C
D
L
M
R

E I O U Y H W
F P V
G J K Q S X Z
T
N

not coded
coded as 1
coded as 2
coded as 3
coded as 4
coded as 5
coded as 6

Consonants after the initial letter are coded in the order they
occur:
HOLMES = H- 452, ADOMOMI = A-355
The code always uses initial letter plus three digits. Further
consonants in long names are ignored:

VONDERLEHR = V-536
Zeros are used to pad out shorter names:
BALL = B-400
SHAW = S-000
Double consonants are treated as one:
BALL = B-400
As are adjacent consonants from the same code group:
JACKSON = J-250
A consonant immediately following an initial letter from the
same code group is ignored:
SCANLON = S-545
Abbreviated prefixes should be spelt out in full:
ST JOHN = SAINTJOHN = S-532
Apostrophes and hyphens are ignored:
KING-SMITH = KINGSMITH = K-525
Consonants from the same code group separated by W or H are
treated as one:
BOOTH-DAVIS = B-312
The Soundex coding rules implemented
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=SOUNDEX.EXE is written in MicroSoft QuickBasic with TSR
capabilities added by the STAY-RES PLUS library from MICROHELP.
The code is supplied to enable you to write your own Soundex
calculator (e.g. for adding Soundex codes to data stotred in
ASCII files) in either QuickBasic or QBASIC (as supplied with
MSDOS v5.xx and v6.xx).
The QuickBasic code
-=-=-=-=-=-=-=-=-=DEFINT A-Z
'$INCLUDE: 'C:\AP\QB45\STAYRES4.DEC'
DECLARE SUB GETKEY (K$)
V$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N$ = "
"
CD$ = ""
CM$ = ""
K$ = ""
L$ = ""
P% = 0
V% = 0

Y% = 0
TRUE = -1
FALSE = 0
Kscan% = 31
Kshift% = 8
DIM A$(26)
DIM C$(26)
FOR X% = 1 TO 26
READ A$(X%), C$(X%)
NEXT
DATA A, ,B,1,C,2,D,3,E, ,F,1,G,2,H, ,I, ,J,2,K,2,L,4
DATA M,5,N,5,O, ,P,1,Q,2,R,6,S,2,T,3,U, ,V,1,W, ,X,2
DATA Y, ,Z,2
DIM P$(12)
CALL SrAutoScreenSave("", Ecode%)
SwapFile$ = "SOUNDEX"
CALL SrForceFile0
CALL SrSetDiskSwap(SwapFile$, Ecode%)
POPDOWN:
LOCATE , , 1
CALL SrPopDown(Kscan%, Kshift%, Ecode%)
START:
LOCATE , , 0
N$ = "
"
P% = 1
DEF SEG = 0
POKE 1050, PEEK(1052)
DEF SEG
POKE 106, 0
COLOR 14, 1
LOCATE 11, 20
PRINT ""
LOCATE 12, 20
PRINT " Surname:
Soundex:
"
LOCATE 13, 20
PRINT ""
LOCATE 12, 31
COLOR 15, 10
PRINT N$;
LOCATE 12, 54
PRINT "
";
DO
CALL GETKEY(K$)
IF K$ = CHR$(13) AND P% > 1 THEN
GOTO SOUNDEX
END IF
IF K$ = CHR$(27) THEN
GOTO POPDOWN
END IF
IF K$ = CHR$(8) AND P% > 1 THEN
P% = P% - 1
MID$(N$, P%, 1) = " "
LOCATE 12, 31
PRINT N$;

END IF
V% = INSTR(V$, K$)
IF V% <> 0 THEN
MID$(N$, P%, 1) = K$
LOCATE 12, 31
PRINT N$;
P% = P% + 1
END IF
LOOP UNTIL P% > 12
SOUNDEX:
CD$ = LEFT$(N$, 1)
FOR Y% = 2 TO LEN(N$)
L$ = MID$(N$, Y%, 1)
IF INSTR("HW", L$) > 0 THEN L$ = ""
CD$ = CD$ + L$
NEXT
CM$ = LEFT$(N$, 1) + "-"
P$(1) = C$(INSTR(V$, LEFT$(N$, 1)))
FOR Y% = 2 TO LEN(CD$)
L$ = MID$(CD$, Y%, 1)
P$(Y%) = C$(INSTR(V$, L$))
IF P$(Y%) = P$(Y% - 1) THEN
L$ = "!"
END IF
IF INSTR(V$, L$) <> 0 THEN
CM$ = CM$ + C$(INSTR(V$, L$))
END IF
NEXT
IF LEN(CM$) < 5 THEN
FOR X% = 1 TO 5 - LEN(CM$)
CM$ = CM$ + "O"
NEXT
END IF
CM$ = LEFT$(CM$, 5)
LOCATE 12, 54
PRINT CM$;
CALL GETKEY(K$)
IF K$ = CHR$(27) THEN
GOTO POPDOWN
END IF
GOTO START
SUB GETKEY (K$) STATIC
K$ = ""
WHILE K$ = ""
K$ = UCASE$(INKEY$)
WEND
END SUB
Status of the program
-=-=-=-=-=-=-=-=-=-=Both the BASIC code and the compiled SOUNDEX.EXE are placed in
the public domain. You are free to distribute the BASIC code,
the compiled SOUNDEX.EXE, and any programs developed from them.
Mark Myatt
London 1995

Das könnte Ihnen auch gefallen