Convert numeric to alpha for display  IBM AS400
This is a discussion on Convert numeric to alpha for display  IBM AS400 ; I'm trying to display a 5.0N to a 3A field.
1) First I did this:
Eval(R) alpha3 = %EDITC(numeric5 : 'K');
* Values less than 100 showed up as 3 blanks.
* Values 100 and above showed up as 2 ...

Convert numeric to alpha for display
I'm trying to display a 5.0N to a 3A field.
1) First I did this:
Eval(R) alpha3 = %EDITC(numeric5 : 'K');
* Values less than 100 showed up as 3 blanks.
* Values 100 and above showed up as 2 blanks and a "1"
2) Try #2:
Eval(R) alpha3 = %TRIM( %EDITC(numeric5 : 'K');
* Values less than 100 showed up as "digit, digit, 1 blank"
* Values 100 and above showed up as a 3 digit number as desired
3) Try #3:
Eval(R) alpha3 = %TRIMR( %EDITC(numeric5 : 'K');
* Values less than 100 showed up as "digit, digit, 1 blank"
* Values 100 and above showed up as a 3 digit number as desired
4) Try #5:
Eval(R) alpha3 = %TRIML( %EDITC(numeric5 : 'K');
* Values less than 100 showed up as "digit, digit, 1 blank"
* Values 100 and above showed up as a 3 digit number as desired
So far the only other option I can see is to move the values to a 3.0N
and then do option #1.
TIA for any help anyone can give.

Re: Convert numeric to alpha for display
On Aug 31, 2:01 pm, Chipper Miller wrote:
> I'm trying to display a 5.0N to a 3A field.
>
> 1) First I did this:
> Eval(R) alpha3 = %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as 3 blanks.
> * Values 100 and above showed up as 2 blanks and a "1"
>
> 2) Try #2:
> Eval(R) alpha3 = %TRIM( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> 3) Try #3:
> Eval(R) alpha3 = %TRIMR( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> 4) Try #5:
> Eval(R) alpha3 = %TRIML( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> So far the only other option I can see is to move the values to a 3.0N
> and then do option #1.
>
> TIA for any help anyone can give.
1st off, What did you want? Lets assume you just want to see the last
3 digits?
Try almost the 1st thing you did!
Evalr alpha3 = %EDITC(numeric5 : 'K');
This should select the last 3 chars of the 5 digit number.
(R) or (M) does something useful to the precision of any intermediate
results, see the manual for more details ;)
I dont think that with 5 digits we need to worry here.
Jonathan

Re: Convert numeric to alpha for display
il 31/08/2007 15.01, Scrive Chipper Miller 40375864:
> I'm trying to display a 5.0N to a 3A field.
>
> 1) First I did this:
> Eval(R) alpha3 = %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as 3 blanks.
> * Values 100 and above showed up as 2 blanks and a "1"
>
> 2) Try #2:
> Eval(R) alpha3 = %TRIM( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> 3) Try #3:
> Eval(R) alpha3 = %TRIMR( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> 4) Try #5:
> Eval(R) alpha3 = %TRIML( %EDITC(numeric5 : 'K');
> * Values less than 100 showed up as "digit, digit, 1 blank"
> * Values 100 and above showed up as a 3 digit number as desired
>
> So far the only other option I can see is to move the values to a 3.0N
> and then do option #1.
>
> TIA for any help anyone can give.
>
In my opinion the R precision rule has no meaning with integer values,
further more it does nothing unless used in calculation.
Did you try evalr instead of eval?
What you need is the right alignement but you'll lose a digit for values
above 999 anyway.

Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñe joAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'

Re: Convert numeric to alpha for display
On Aug 31, 9:23 am, "Dr.UgoGagliardelli"
wrote:
> il 31/08/2007 15.01, Scrive Chipper Miller 40375864:
> Did you try evalr instead of eval?
> What you need is the right alignement but you'll lose a digit for values
> above 999 anyway.
>
OOOOF!! Yes! evalR, not eval(R)  I had a brain cramp. Thanks to
Jonathan & Dr. U G for helping me out! It's kind of like the
PARIS
IN THE
THE SPRING
situation where you THINK you know what it says but...