Yes,I agree with Randy...this would be approaching 6000/yr.Randy Chase said:I have a feeling it is not correct.
Very close. Here t'is in hamfisted Perl code if it helps:MikeGalos said:I've never found the formula used for US VINs but typically, you add all the digits together including numbers representing the characters and then either look up the value of the check digit or subtract the total you got from a fixed value and use that as the code for the check digit.
#!/usr/bin/perl
{
$vin = "SCCPC11105HL30022"; # VIN to test for validity
print "Trying $vin\n";
# Each VIN characters has a numeric value:
%value = (
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5,
'6' => 6, '7' => 7, '8' => 8, '9' => 9,
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6,
'G' => 7, 'H' => 8,
'J' => 1, 'K' => 2, 'L' => 3, 'M' => 4, 'N' => 5,
'P' => 7,
'R' => 9, 'S' => 2, 'T' => 3, 'U' => 4, 'V' => 5, 'W' => 6,
'X' => 7, 'Y' => 8, 'Z' => 9 );
# Each VIN digit position has a multiplier
@weights = (8,7,6,5,4,3,2,10, 0, 9,8,7,6,5,4,3,2);
my $count = 0;
my $sum = 0;
my $gotchk = "";
# add up all the digits * weights
foreach $digit (unpack ("c*", $vin)) {
$sum += $value{chr($digit)} * $weights[$count++];
$gotchk = chr($digit) if ($count == 9);
}
# Check digit is sum mod 11
my $check = $sum % 11;
my $chk = '0' + $check;
$chk = 'X' if ($check == 10);
# verify against what we received as ninth digit
if ($chk == $gotchk) {
print "$vin OK\n";
} else {
print "$vin FAIL $chk $gotchk\n";
}
}
Thanks, Larry. Congrats to you, as well. It's actually much easier for me to wait knowing that the car is almost here.LarryB said:jml- congrats! The wondering is over , now the real wait starts.
My car had a Sept bulid date, made it to port around Oct 22, VIN 524. A 1000 VIN does seem a bit high.