home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
CK-DIGIT.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
3KB
|
58 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-12-05 ╟─╖
│ │ FILE NAME CK-DIGIT.DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB01.INC
COLOR 7, 0
CLS
? "┌───────────────────────────────────────────────────────────────────────"
? "│ fCheckDigit%( AccountNumber$ ) "
? "├───────────────────────────────────────────────────────────────────────"
? "│ PURPOSE: create/compute a check-digit for account numbers "
? "│ PARAMS: ANo$ an account number string of no more than 10 characters "
? "│ preceding an optional '-' and containing no characters "
? "│ other than the 10 digits. "
? "├───────────────────────────────────────────────────────────────────────"
? "│ Check digits protect, primarily, from transposed figures more than "
? "│ from total cases of dumb that seem to strike occasionally. Several "
? "│ banks and credit unions use a system like this to protect, as much "
? "│ as possible from these mistakes. As there are no hard and set rules "
? "│ about where and how the check digits are attached to the account N° "
? "│ but the norm is 12345-9 where the 9 is the check digit. "
? "└───────────────────────────────────────────────────────────────────────"
?
AcctNo$ = "123456789-3" : GOSUB CKCKDIG
AcctNo$ = "213456789-3" : GOSUB CKCKDIG
END
' ───────────────────────────────────────────────────────────────
CKCKDIG:
PRINT AcctNo$;
IF VAL( RIGHT$( AcctNo$, 1 ) ) <> fCheckDigit%( AcctNo$ ) THEN
PRINT " HAS AN ERROR"
ELSE
PRINT " IS CORRECT"
END IF
PRINT
RETURN