Parse address, city, st and ZIP

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

Parse address, city, st and ZIP

Post by Dave » Mon Apr 08, 2013 8:01 am

If you have Address city st and zip in one field you can run the following command from the Edit|Command option.
Make sure that the Address City ST and ZIP information is all located in the ADDRESS field.

Code: Select all

use in iif(used('_uszips'),select('_uszips'),0)
replace zip with allt(substr(address,rat(" ",allt(address)))),;
	address with left(address,rat(" ",allt(address)));
	for empty(zip) and isdigit(right(allt(address),1))
replace address with allt(address)+" "+zip,;
	zip with "" for isalpha(allt(zip))
public comalias
use (addbs(xDefFldr)+"dmm\_uszips.dbf") in 0 order uszip
replace city with _uszips.prefcity,;
	st with for seek(left(zip,5),'_uszips')
use in iif(used('_uszips'),select('_uszips'),0)
replace address with left(address,rat(left(city,4),upper(address))-1) ;
	for !empty(city) and rat(left(city,4),upper(address))>0
replace city with allt(substr(address,rat(" ",allt(address),2))) for (empty(city) ;
	or allt(st) $ address)
replace address with strtran(address,allt(city)) for allt(city) $ address and !empty(city)
replace address with allt(address)+" "+city for !" " $ allt(address)
replace city with "" for allt(city) $ address and !empty(city)
replace all address with strtran(address,",","")
release comalias

Post Reply