Scan for empty(City) Scatter name oRecord ParseCSZ(oRecord) Gather name oRecord Endscan Function ParseCSZ Lparameters toRecord Local llZipFound, llStateFound, lnLines, lcCSZ Local array arrLines[1] lnLines = alines(arrLines, chrtran(trim(toRecord.CSZ),' ',chr(13))) If lnLines = 1 && No state,zip info toRecord.City = toRecord.CSZ Return Endif Store .f. to llZipFound, llStateFound lcCSZ = toRecord.CSZ lcCity = lcCSZ For ix=lnLines to 1 step -1 If !llZipFound and IsZip(arrLines[ix]) toRecord.Zip = arrLines[ix] llZipFound = .t. lcCity = stuff(lcCity,rat(toRecord.Zip,lcCity),5,'') Endif If !llStateFound and IsState(arrLines[ix]) toRecord.STate = arrLines[ix] llStateFound = .t. lcCity = stuff(lcCity,rat(toRecord.STate,lcCity),2,'') Endif Endfor toRecord.City = lcCity Function IsState Lparameters tcString Return len(tcString)=2 ; and tcString == upper(tcString) ; and IsAlpha(tcString) and IsAlpha(right(tcString,1)) Function IsZip Lparameters tcString Return len(tcString) = 5 and ; tcString == chrtran(tcString,chrtran(tcString,'0123456789',''),'') ; and val(tcString) # 0Cetin