|
I'm trying to develop the program logic flow for a Canadian zip code
ranging program. I've written an easy zip code ranging progam for US zip
codes. It was easy to write because all I had to do was check to see if
the current_zipcode was equal to the previous_zipcode plus 1.
Below is an example of how the program ranged the input file.
Input file:
CITY1 13760
CITY1 13761
CITY1 13762
CITY2 13855
CITY2 13856
CITY3 12345
CITY3 12348
CITY4 23567
CITY5 65432
Output file:
CITY1 13760 - 13762
CITY2 13855 - 13856
CITY3 12345 - 00000
CITY3 12348 - 00000
CITY4 23567 - 00000
CITY5 65432 - 00000
Here's how I want to range the Canadian zip codes:
Input file:
CITY1 T0B0Z0
CITY2 T0A0A0
CITY3 T0A0C0
CITY4 T4A1A1
CITY4 T4A1A2
CITY4 T4A1A3
CITY4 T4A1B1
CITY4 T4A1B2
CITY4 T4A1B3
CITY4 T4A1D1
CITY4 T4A1D2
CITY4 T4A1D3
Output file:
CITY1 T0B0Z0 - 000000
CITY2 T0A0A0 - 000000
CITY3 T0A0C0 - 000000
CITY4 T4A1A1 - T4A1B3
CITY4 T4A1D1 - T4A1D3
Here's some ideas of what I was trying to make something out of:
> if first 5 positions from current_zipcode is equal to first 5 positions
of previous_zipcode, they match, now check to make sure the 6th position is
in numerical sequence with the previous_zipcode
-if not in sequence, start a new range
-if in sequence, get next record to see if it's also in sequence
> if first 5 positions from current_zipcode do not match first 5 positions
of previous_zipcode
-if first 4 positions from current_zipcode is equal to first 4
positions of previous_zipcode, they match, now check to make sure the
5th positions is in alphabetical sequence with the previous_zipcode
*if not in sequence, start a new range
*if in sequence, get next record to see if it's also in
sequence
The above might be a good way to go, but if anyone else has a better/easier
way to get this done, please let me know.
Thanks,
Frank
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.