× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I haven't tested it, but initial thoughts would be (forgive the spacing, it's 
off the top of my head after a little Christmas Spirit...):

D SIN       ds
D  ChkDigit          9  0
D  Chk               1s 0   Dim(9) Overlay(ChkDigit : 1)

D Result    ds
D  RslDigit          2  0
D  Rsl               1s 0   Dim(2) Overlay(RslDigit : 1)

D Total     s        3s 0
D ValChkDgt s        1s 0

 * Weight the "even" positions...
C               Eval    Total = *Zeros
C               For     I = 2 by 2 to 8 
C               Eval    RslDigit = Chk(I) * 2
C               Eval    Total = Total + Rsl(1) + Rsl(2)
C               EndFor

 * Add the "odd" positions...
C               For     I = 1 by 2 to 7
C               Eval    Total = Total + Chk(I)
C               EndFor

 * Subtract from the next multiple of 10...
C               Eval    ValChkDgt = ((%Int(Total/10)+1)*10) - Total
 
 * Test the check digit...
C               If      ValChkDgt = Chk(9)
C               ...okay...
C               Else
C               ...Invalid
C               EndIf



All the best

Jonathan
www.astradyne-uk.com
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Muralidhar Narayana
Sent: 22 December 2004 20:04
To: rpg400-l@xxxxxxxxxxxx
Subject: Just checking


Just checking whether anyone has wrote a logic to validate the check digit as 
per the procedure listed in below link for Canada social insurance number.I 
wrote but ended up with 50line code
   http://www.cs.queensu.ca/home/bradbury/checkdigit/sincheck.htm
 
would be greatful if you can share...

-- 
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.