Add SCF And Zone information to your database

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
Dave
Site Admin
Posts: 620
Joined: Wed Sep 20, 2006 3:20 pm

Add SCF And Zone information to your database

Post by Dave » Mon May 18, 2009 3:59 pm

The following command will add fields named SCF and Zone, and populate the respective fields with the SCF 3 digit ZIP Codes and Zone numbers. Follow these instructions to make the command work:

1. Open AccuZIP6 5.0, any database, then select Commands… from the Edit menu.
2. Enter the code below in the command statement syntax area.
3. Change the 3-Digit ZIP Code at the beginning of the command to the STARTING ZIP Code point from where the Zones will be calculated.
4. Click Run

Code: Select all

* Get start 3-digit zipcode
cZip3="980"
cZip3=LEFT(cZip3,3)

* Suppress Messages
ON ERROR com_Mesg=MESSAGE()

* Add SCF column; Add Zone column
ALTER TABLE (ALIAS()) ADD COLUMN scf C(3)
ALTER TABLE (ALIAS()) ADD COLUMN zone C(3)

* Add SCF number
REPLACE ALL scf WITH substr(GetLineValue(ADDBS(xDefFldr)+"iPresort\DMM\AZL002C.txt",INT(VAL(LEFT(zip,3))),67,.T.,.T.),9,3)

* Get Zone Chart line
ps5ZoneChartData=GetValue(addbs(xdeffldr)+"iPresort\DMM\azformat2.txt",cZip3,1,1,1,1,"","",1,1,1)
ps5ZoneChartData=" "+substr(ps5ZoneChartData,4)

* Add Zone number
REPLACE all zone WITH SUBSTR(ps5ZoneChartData,val(left(zip,3))*2,1)
5. When the command is completed, close the Command window.
6. Pull down the View menu to List View Default to see the newly-added fields, then scroll to the right in your database until you see the zone and scf fields.

Post Reply