>>>>I am faced with the need to create (actually participate with) an alphabetic numbering system. The sequence is straight forward, and looks like this:
>>>>
>>>>AAAA
>>>>AAAB
>>>>.
>>>>.
>>>>AAAZ
>>>>AABA
>>>>
>>>>etc.
>>>>
>>>>Really my only need is to be able to increment these codes by one, so I need a function that receives "DPRZ" and returns "DPSA". Get it?
>>>>
>>>>I am fairly confident that I can pound out the code to do this, but all of my ideas so far would take an enormous amount of code- can anybody think of a practical solution?
>>>
>>>
>>>FOR n1=65 to 90
>>> FOR n2=65 to 90
>>> FOR n3=65 to 90
>>> FOR n4=65 to 90
>>> cString=CHR(n1)+CHR(n2)+CHR(n3)+CHR(n4)
>>> ENDFOR
>>> ENDFOR
>>> ENDFOR
>>>ENDFOR
>>>
>>
>>This will indeed work to produce an initial list, but I don't want to store a list. I need to pass a parameter and receive a parameter that is one greater than the initial value. Your post has me thinking along different lines though...
>>
>>PROCEDURE Increment
>
>
>You just need to think in base 26 (A-Z) instead of base 10, constructing each "digit" in the new base. Hope that's clear enough for you.
Clear as a whistle. And I know exactly the nature of the task, but I am finding that implementing a numbering system from scratch is proving to be a larger task than I expected.
Actually I think I have come to the conclusion that what I need is a BASE 26 to Base 10 function, then I can increment the number with + 1 and then convert the base10 number back to 26.
lcStartCode = "AAAA"
lnStartNumber = Base26ToBase10(lcStartCode) && produces 0
lnResult = lnStartNumber + 1
lcResult = Base10ToBase26 && produces "AAAB"
How does that sound?
Erik Moore
Clientelligence