IBM Modulus 10
Oran Shapitka
oran@intertechsystems.com
Wed, 30 Aug 2000 15:26:50 -0600
The following code is from a quick screen but could be converted to quiz
without to much trouble. Hope this helps you out.
procedure input sin of student
begin
if not findmode
then begin
if (fieldtext = "" and sin of student = " ") or &
0 = nconv(fieldtext)
then let fieldtext = "000000000"
else begin
let mod10 = fieldtext
let interven-digits = (nconvert(mod10[1:1])) + &
(nconvert(mod10[3:1])) + &
(nconvert(mod10[5:1])) + &
(nconvert(mod10[7:1]))
let modsum = (ascii((nconvert(mod10[2:1] + &
mod10[4:1] + &
mod10[6:1] + &
mod10[8:1])) * 2,5))
let cross-add = (nconvert(modsum[1:1])) + &
(nconvert(modsum[2:1])) + &
(nconvert(modsum[3:1])) + &
(nconvert(modsum[4:1])) + &
(nconvert(modsum[5:1]))
let total = interven-digits + cross-add
let calc-check-digit = &
((ascii(10 - (nconvert((ascii(total,2)[2:1]))),2))[2:1])
let check-digit = fieldtext[9:1]
if check-digit <> calc-check-digit
then error = "Invalid Social Insurance Number"
end
end
end
; _______________________________________________________________
; | Standard Modulus 10 Check Digit Formula |
; | Check |
; | Basic No. Digit |
; | ----------- ----- |
; | Number . . . . . . . . . . . . . . . . 193 456 787 7 |
; | =================== |
; | Make a number from unit position |
; | and each alternate position to |
; | the left . . . . . . . . . . . . . . 9 4 6 8 |
; | |
; | Add the number to itself . . . . . . . 9 4 6 8 |
; | ---------- |
; | Sum . . . . . . . . . . . . . . . . . 18 9 3 6 |
; | |
; | Cross add the digits in the sum |
; | (1 + 8 + 9 + 3 + 6)or(1 + 8 + 8 + 1 + 2 + 1 + 6)= 27 |
; | |
; | Cross add intervening digits |
; | (1 + 3 + 5 + 7) 16 |
; | --- |
; | Total . . . . . . . . . . . . . . . . . . . . . . . 43 |
; | |
; | If the total is a multiple of 10, the check |
; | digit is 0, otherwise subtract from next |
; | highest number ending in zero 50 |
; | === |
; | Check Digit Is . . . . . . . . . . . . . . . . . . . 7 |
; |_______________________________________________________________|
Oran Shapitka, ISP
Intertech Business Systems, Inc.
1564, 10303 Jasper Ave Email: oran@intertechsystems.com
Edmonton, AB T5J 3N6 Canada Voice: (780) 413-0400 Fax: (780) 413-0398
<http://www.intertechsystems.com/>
-----Original Message-----
From: owner-powerh-l@sphere.swau.edu
[mailto:owner-powerh-l@sphere.swau.edu]On Behalf Of Stamps, Theron
Sent: Wednesday, August 30, 2000 3:17 PM
To: 'powerh-l@lists.swau.edu'
Subject: IBM Modulus 10
Does anyone have experience with using the !BM Modulus 10 routine
inside a Quiz program? We are creating a scanline during extraction and
need to include the check digit. Quiz doesn't seem to like adding digits in
a single numeric ie. 12 needs to be converted too 1+2= 3.
Has someone dealt with a work around?
Theron J. Stamps
Systems Analyst
San Angelo Standard-Times
http://www.gosanangelo.com
http://www.texaswest.com
Voice: 915.659.8220
Pager: 1.800.788.0207
Text Pages: www.skytel.com
stampstj@texaswest.com
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.