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



Hi Gad -

On Wed, 17 Jun 2015 08:44:19 +0300, Gad Miron
<gadmiron@xxxxxxxxx> wrote:

Since it happens to be a CHAR field I would like to start using the
letters A-Z
in lexical order when incrementing this field so that incrementing
899999 will result in 9AAAAA , 9AAAAB , ......., 9AAAAZ, 9AAAA0, 9AAAA1 etc.
(This way the numerator will sort the EBCDIC natural way)

If this is in RPG, I would use either a compile-time array or a
character field that contains the list of characters to be used,
ordered in the same way that they sort.

Then starting from the right of the field to be incremented, LOOKUP
(array) or SCAN (field) for the character.

If it is found and not the last character in the list, increment to
the next character to the list and update the field with that
character.

If it is the last character (or not found), update the field with the
first character in the list, move one character to the left, and
repeat.

You will need to determine what you want to do if you get all the way
to the left end and still need to increment (i.e. field overflow).

Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.


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.