Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
|
|
@ -1,12 +1,25 @@
|
|||
/*REXX pgm uses H. Michael Damm's algorithm to validate numbers with suffixed check sum.*/
|
||||
@.0= 0317598642; @.1= 7092154863; @.2= 4206871359; @.3= 1750983426; @.4= 6123045978
|
||||
@.5= 3674209581; @.6= 5869720134; @.7= 8945362017; @.8= 9438617205; @.9= 2581436790
|
||||
call Damm 5724, 5727, 112946, 112940 /*invoke Damm's algorithm for some #'s.*/
|
||||
exit 0 /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
Damm: do j=1 for arg(); x= arg(j); $= 0; z= right(x, 1)
|
||||
do p=1 for length(x); g=$; $= substr(@.$, 1 + substr(x, p, 1), 1)
|
||||
end /*p*/
|
||||
if $==0 then say ' valid checksum digit ' z " for " x
|
||||
else say ' invalid checksum digit ' z " for " x ' (should be' g")"
|
||||
end /*j*/; return
|
||||
/*REXX pgm uses H. Michael Damm's algorithm to validate numbers with suffixed check sum. digit*/
|
||||
a.0= 0317598642; a.1= 7092154863; a.2= 4206871359; a.3= 1750983426; a.4= 6123045978
|
||||
a.5= 3674209581; a.6= 5869720134; a.7= 8945362017; a.8= 9438617205; a.9= 2581436790
|
||||
Call Damm 5724, 5727, 112946, 112940 /*invoke Damm's algorithm To some #'s.*/
|
||||
Exit /*stick a Tok in it, we're all Done. */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
Damm:
|
||||
Do j=1 To arg() /* loop over numbers */
|
||||
x=arg(j)
|
||||
d=0
|
||||
Do p=1 To length(x)-1 /* compute the checksum digit */
|
||||
d=substr(a.d,substr(x,p,1)+1,1)
|
||||
end /*p*/
|
||||
z=right(x,1) /* the given digit */
|
||||
If z=d Then Say ' valid checksum digit ' z " for " x
|
||||
Else Say ' invalid checksum digit ' z " for " x ' (should be' d")"
|
||||
End /*j*/
|
||||
Return /syntaxhighlight>
|
||||
{{out|output|text= when using the (internal) default inputs:}}
|
||||
<pre>
|
||||
valid checksum digit 4 for 5724
|
||||
invalid checksum digit 7 for 5727 (should be 4)
|
||||
valid checksum digit 6 for 112946
|
||||
invalid checksum digit 0 for 112940 (should be 6)
|
||||
</pre>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue