Calculate a check digit

Build your list of AccuZIP6 commands by requesting commands and sharing commands with other users

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
User avatar
Eric
Moderator
Posts: 1910
Joined: Tue Sep 19, 2006 3:29 pm
Contact:

Calculate a check digit

Post by Eric » Thu Apr 03, 2008 8:23 am

The following command calculates a check digit when the ZIP+4 and delivery point are present in your database. The command assumes you have the following fields in your list:

chkdigit (for the check digit number)
zip
zip4
dp (for the delivery point)

Code: Select all

replace all chkdigit with SUBSTR(PADL(ALLT(STR(100-(VAL(LEFT(zip,1))+VAL(SUBSTR(zip,2,1))+VAL(SUBSTR(zip,3,1))+VAL(SUBSTR(zip,4,1))+VAL(SUBSTR(zip,5,1))+VAL(SUBSTR(zip4,1,1))+VAL(SUBSTR(zip4,2,1))+VAL(SUBSTR(zip4,3,1))+VAL(SUBSTR(zip4,4,1))+VAL(SUBSTR(dp,1,1))+VAL(SUBSTR(dp,2,1))))),2,"0"),2,1)
Chat with an AccuZIP6 technician weekdays from 7-4 PST with AccuZIP6 Live Online Support

Post Reply