Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] About Converting From Numeric to Alphanumeric Format

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] About Converting From Numeric to Alphanumeric Format
 Login/Join
 
Gold member
posted
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
 
Posts: 97 | Registered: August 18, 2009Report This Post
Member
posted Hide Post
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
 
Posts: 25 | Registered: June 23, 2009Report This Post
<JG>
posted
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.
 
Report This Post
Gold member
posted Hide Post
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
 
Posts: 97 | Registered: August 18, 2009Report This Post
Gold member
posted Hide Post
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
 
Posts: 97 | Registered: August 18, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] About Converting From Numeric to Alphanumeric Format

Copyright © 1996-2020 Information Builders