× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Tell me this.  If you have the following input list:

CITY1   T4A1A1
CITY1   T4A1A2
CITY1   T4A1A3
CITY1   T4A1A4
CITY1   T4A1A6
CITY1   T4A1A7
CITY1   T4A1A8
CITY1   T4A1A9

and these are the only valid zip codes for CITY1, and note that T4A1A5 is
not on that list, nor is it a valid zip code (currently) for any other city,
will your desired output be:

CITY1       T4A1A1 - T4A1A4
CITY1       T4A1A6 - T4A1A9

If this is true, then I don't think a simple level break is going to do it
for you then.

Continuing on that presumption, the way your U.S. zip code program worked
was that you just kept adding 1 to get the next zip code, correct?

Sounds to me like you'd want to calculate a sequential decimal number based
on the base26-base10-base26-base10-base26-base10 nature of the canadian zip
code.  To break it down more easily, think of the zip code as a
base260-base260-base260 number.

Hopefully this makes some sense: Just thinking without testing this out
(I'll leave that to you if you think it's worth a go), but try breaking the
6 bytes into three 2-byte chunks.  Each 2-byte combo has a decimal range
from 0 (A0) to 260 (Z9).  Calculate the decimal value for each of the three
chunks.  Your sequential decimal number for the entire zip code will be
calculated as:

n = (A1 * 260 ** 2) + (B2 * 260) + C3
 or
n = (A1 * 67600)    + (B2 * 260) + C3

where A1 is the calculated decimal value for the first 2-byte chunk, B2 is
the calculated decimal value for the second 2-byte chunk, and C3 is the
calculated decimal value for the third 2-byte chunk.

I think this will give you the sequence you are seeking so you can test for
a zip code being the next possible one in sequence from the previous one.

There may be a far easier way to accomplish this.  Gosh, does SQL do base
conversions?

I would be extremely interested in knowing how you end up doing this.

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx / fkany@xxxxxxxxxxxxxxxxxx
> Sent: Tuesday, October 19, 2004 4:41 PM
>
> Dan,
>
> Here you go:
>
>> Does the input file have every possible Canadian zip code in it?
> Yes
>
>> Why is the range T4A1A1 - T4A1B3 valid but T4A1A1 - T4A1D3 is not?  Does
>> (or could) zip code T4A1A5 exist?
> T4A1A1 - T4A1D3 is missing T4A1C1-T4A1C3.
> Yes, T4A1A5 exists, but I was only trying to give an example.
>
>> What was the logic you used to accomplish the task for good ole' U.S. zip
>> codes?
> If the previous zip_code was 10001 then the next zip code must be
> 10002 to be in sequence.
>
>> Have you tried, or has someone else suggested, reading the input file in
>> zip code sequence, and doing level break processing when the city
>> name changes?
> Yes, I wish I had thought of this a week ago.
>
> Frank(still kicking my @$$)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.