|
Hi,
Try with to write a function like this :
P e
PNextChar b
D pi 7
D Your_letter 1
D Array_char S 26
D New_Pos S 2 0
/free
Array_char='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
Pos=%scan(Your_letter:Array_char);
Pos=Pos+1;
// "Z" + 1 => A ????
If (Pos=27);
Pos=1;
Endif;
If (Pos>1);
Return (%subst(Array_char:Pos:1));
Else;
// The character was not found
Return (" ");
Endif;
/endfree
P e
I'm not an RPG expert and I'm not sure that it is the easiest way but I
hope it can be helpful for you.
Pascal PEYRE
Responsable Informatique Adjoint
CIR
80, Rue Jacques Babinet 31047 Toulouse
France
-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Booth Martin
Envoyé : lundi 29 mai 2006 21:18
À : RPG programming on the AS400 / iSeries
Objet : Re: Add to Character Value
Gosh, I bet its pretty easy, but for the moment the answer escapes me.
Some of the others here can help, I bet.
Don Wereschuk 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. ****************************************** Don Wereschuk ISD Associate - Programmer Simcoe Parts Service Inc. Phone: 705-435-7814 Ext.: 302 Fax: 705-435-6746 dwereschuk@xxxxxxxxxxxxxxx ****************************************** -----Original Message----- From: Booth Martin [mailto:booth@xxxxxxxxxxxx] Sent: Monday, May 29, 2006 3:00 PM To: RPG programming on the AS400 / iSeries Subject: Re: Add to Character Value Can you create an array of all valid values ranked in the order you choose. Then do a lookup on a character, add 1 to the array, and
choose
that new element as your new value. It isn't clear to me what you would want "Q + 1" to equal, or "q + 1".
An array that you construct would resolve that ambiguity. Don Wereschuk wrote:Does anyone know of a method to increment a character value . For instance I want to increase the value 'A' to be the value 'B'. ****************************************** Don Wereschuk ISD Associate - Programmer Simcoe Parts Service Inc. Phone: 705-435-7814 Ext.: 302 Fax: 705-435-6746 dwereschuk@xxxxxxxxxxxxxxx ******************************************
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.