× 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.




Dan,

I've inserted my answers in your email below.





"Dan Bale" <dbale@xxxxxxxxxxxxx>@midrange.com on 10/19/2004 04:17:32 PM

Please respond to RPG programming on the AS400 / iSeries
       <rpg400-l@xxxxxxxxxxxx>

Sent by:    rpg400-l-bounces@xxxxxxxxxxxx


To:    "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
cc:

Subject:    RE: Trivia: How many lines of code are allowed in an RPG
       Program?


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

>> YES

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 don't know the answer to this question.

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

>> I'm going to look into your method of assigning each 2 byte field a
number(a1=1 and z9=260).  I think it might work.  I'll let you know how it
turns out.

Frank




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.