Incrementing Alphanumeric Fields

Kenneth Brody kenbrody at spamcop.net
Thu Jan 19 09:04:15 PST 2012


On 1/18/2012 4:41 PM, Rod Caddy wrote:
> I have a customer running SCO Unix with Filepro 4.5.  They have a file
> that they use as experimental documentation before they turn the product
> into a real product number.  In the experimental file there is an
> experimental number that was setup as (4, allup). They use the
> processing below to increment the numbers.  The numbers are A000, A001,
> etc.  The problem is that the Alpha does not increment correctly.  It
> will work for a while and then will jump to Uxxx.(xxx being the numeric
> portion of the number.  I am open to ideas here, I have tried modifying
> the code several ways and have had very little success.
[...]

 From your code, I assume what you want is a 4-digit code which originally 
runs from 0000 to 9999.  After that, you want the thousands place to wrap to 
letters, so that 9999->A000, A999->B000, and so on, up to Z999.

Is that correct?

This assumes that "num" is the (4,allup) field you wish to "increment".

==========
declare last3(4,0rj), first1(1,*)
first1 = mid(num,"1","1") ; last3 = mid(num,"2","3") + "1"
num = base(base(first1,"36")+int(last3/"1000"),"10","36") &
       mid(last3,"2","3")
==========

-- 
Kenneth Brody


More information about the Filepro-list mailing list