Focal Point
[SOLVED] About Converting From Numeric to Alphanumeric Format

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/980101172

October 19, 2009, 05:29 AM
Yangyang
[SOLVED] About Converting From Numeric to Alphanumeric Format
i want get the char from number

my code:

COMPUTE NAME1/A10 = EDIT(110023); NOPRINT
COMPUTE NAME2/A200 = '<_OPTION VALUE=''' || NAME1|| '''>' || 'KEY'|| '';

the error :

(FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: NAME1
(FOC009) INCOMPLETE REQUEST STATEMENT

HOW CAN I GET THE NAME2 WHIT NAME1 ? NUMBER TO CHAR
I USED
NAME1/A15 = FTOA(110023, '(A15)', NAME1);
NAME1/A15 = FTOA(110023, '(I15)', NAME1);
BUT IT'S NOT WORK...

I'M NO IDEA...

CAN SOMEBODY HELP ME?

THANKS,
Yang

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
October 19, 2009, 05:52 AM
ac1
In the DEFINE clause you can do:

-* Floating number
X     /F15  = 110023;                                                   
-* Convert a floating numer to alpha
X1    /A15  = FTOA(X, '(F15)', X1);                                     
-* Justify the number to left
X2    /A15  = LJUST(15,X1,X2);                                          
-*
NAME2 /A200 = '<_OPTION VALUE=''' || X2 || '''>' || 'KEY'|| '';          


EDIT function put leading zeroes, so you get 000000000110023

bye



FOCUS 7.2.0S1
Mainframe - MVS 390
Excel, Flat file

Italy
October 19, 2009, 06:19 AM
<JG>
Using a numeric directly in EDIT and FTOA/PTOA is not allowed.

For edit use

COMPUTE NAME1/A10 = EDIT(EDIT('110023')); NOPRINT

There is no equivalent for FTOA/PTOA and the value must be assigned to a field first.

But if you are using a static value then do the obvious

COMPUTE NAME2/A200 = '<_OPTION VALUE=''' || '110023' || '''>' || 'KEY'|| '';

However I assume that you are just giving a poor example of what you want to do and it's
actually a column that you want in there, in which case standard EDIT or FTOA is all you need.
October 19, 2009, 10:54 PM
Yangyang
thank you ac1
thank you JG.

the number length is 0~99999

i try to your idea.

Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
October 19, 2009, 11:00 PM
Yangyang
quote:
-* Convert a floating numer to alpha


thanks all, i fixed it.

my code:

TABLE FILE XSQLOUT
SUM
*
COMPUTE NEW1/A2 = SUBSTR(15, NAME, 3, 4, 2, NEW1); NOPRINT
COMPUTE NEW2/A2 = SUBSTR(15, NAME, 6, 7, 2, NEW2); NOPRINT
COMPUTE Y_DESC/I4MTY=EDIT (NEW2||NEW1) ; NOPRINT
COMPUTE X /F15 = MAIN_ID;NOPRINT
COMPUTE X1 /A15 = FTOA(X, '(F15)', X1); NOPRINT
COMPUTE X2 /A15 = LJUST(15,X1,X2);NOPRINT
COMPUTE test/A50=X2||NAME ;
HEADING
.............


Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET