Incrementing Alphanumeric Fields

GCC Consulting rkreiss at gccconsulting.net
Wed Jan 18 14:26:23 PST 2012



-----Original Message-----
From: filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com [mailto:filepro-list-bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of Rod Caddy
Sent: Wednesday, January 18, 2012 4:42 PM
To: filePro List
Subject: Incrementing Alphanumeric Fields

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.


   1  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: end
   2  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
@wef1    If: 1 ne ""
        Then: end
   3  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: r(4,allup)="ZZZZ"
   4  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: lookup new = exp  k=r    i=a -el
   5  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If: new(1)="9999"
        Then: 1="A000"; display; end
   6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: 1=new(1)
   7  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If: mid(1,"2","3")="999"
        Then: 1=chr(asc(mid(1,"1","1"))+"1"){"000"; display; end
   8  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: mid(1,"2","3")=mid(1,"2","3")+"1"
   9  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If: mid(1,"2","2") = "  "
        Then: mid(1,"2","2")="00"; display; end
  10  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If: mid(1,"2","1") = " "
        Then: mid(1,"2","1")="0"; display; end
  11  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
-   -
          If:
        Then: display; end


You might consider:

Aa(1,allup)=mid(1,"1","1");ab(3,.#)=mid(1,"2",3")   - separate value into its components

Ac(1,allup)=chr(asc(aa)+"1");ad(3,rjzero)=ab+"1";ae=ac{ad

If I recall correctly, there should be a zero fill edit available.  You could use this edit       rjzero ◄\0\{n}

Richard Kreiss
GCC Consulting

Office: 410-653-2813





More information about the Filepro-list mailing list