|
Hi Marco, This problem stems from some legacy code we have at our facilities. The original programmers did not leave enough room for an acceptable amount of characters in the field. The field is defined as 3A. This field is part of a control number that is used in a multitude of programs (that will eventually need to be rewritten at a future date). Unfortunately, we have occasions where the control number exceeds 999. When this occurs, the system has been written to flip the first digit to an alpha character. Thus when the 999 threshold is exceeded, the new control number becomes A01. Further to that, when A99 is the last control number and a new record is created, the next control number becomes B01. And so on...C01, D01, ad nauseum. So what we're looking at is something that will detect when x99 is reached and flip to the next alpha character in sequence. So based on this, we'd be looking for some code similar to this: If FLDX = 99 then If subst(FLDX:1:1) = A NewCTRLNum = CHAR(subst(FLDX:1:1)+1) + '01' Endif; Endif; The question is - is there an equivalent to CHAR() in RPG? Essentially we'd need to find the hex or decimal value of the next available character. For example, if A = char(1) and B = char(2), when we did a Char(1+1), we'd get B as the next character. I hope this response hasn't confused or made the process sound more complicated than it is. Brian. -----Original Message----- From: Marco Facchinetti [mailto:facchinetti@xxxxxxxxx] Sent: Monday, May 29, 2006 4:58 PM To: RPG programming on the AS400 / iSeries Subject: RE: Add to Character Value Alpha codes like "AAA", "AAB", "AAC"...? Marco --- Don Wereschuk <dwereschuk@xxxxxxxxxxxxxxx> wrote:
WHAT I AM LOOKING FOR IS THE EXPRESSION 'A' + 1 = 'B' . I WANT TO INCREASE THE CHARTERS IN ORDER FROM 'A' TO 'Z' BY ADDING 1 TO THE CHARACTER.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.