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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED]Converting Packed-Decimal to Alphanumeric

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]Converting Packed-Decimal to Alphanumeric
 Login/Join
 
Gold member
posted
I am trying to convert a packed decimal value of P21.9 to alphanumeric. I have tried using the PTOA function and it gives me a strange output with a bunch of funny characters. Smiler

I tried using the CAR file and just doing a simple FTOA with the DEALER_COST field and it gives me the same output.

 
TABLE FILE CAR
PRINT 
     'CAR.ORIGIN.COUNTRY'
     COMPUTE VAL1/A7 = FTOA(CAR.BODY.DEALER_COST, '(A7)', VAL1);
END


Output

COUNTRY VAL1
ENGLAND ½
ENGLAND ÝÅ
ENGLAND .Í
ENGLAND Ä°
JAPAN „¤
JAPAN Œ¦
ITALY 3³
ITALY ¶
ITALY ¶
ITALY jØ
W GERMANY dz
W GERMANY ¨¶
W GERMANY p·
W GERMANY ˆÃ
W GERMANY |Å
W GERMANY 6À
W GERMANY hÀ
FRANCE ²


Can anyone help me with this? I have no idea why it would be giving me this type of output.

Thanks,

Dave

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


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML
 
Posts: 71 | Location: Kingston, ON | Registered: May 03, 2011Report This Post
Virtuoso
posted Hide Post
Use the source format in the function:

TABLE FILE CAR
PRINT 
     'CAR.ORIGIN.COUNTRY'
     COMPUTE VAL1/A7 = FTOA(CAR.BODY.DEALER_COST, '(D7)', VAL1);
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
Thanks Dan. It is wierd as the Help file for DevStudio says to use the Output format. Maybe I just misunderstood.

Your solution worked. Thanks for the help.

Dave


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML
 
Posts: 71 | Location: Kingston, ON | Registered: May 03, 2011Report This Post
Virtuoso
posted Hide Post
The documentation for the FTOA and PTOA is confusing. By output format, they mean any special formatting that you may want to see in the output. In this case, for example, you could put a dollar sign and decimals in the output:

TABLE FILE CAR
PRINT 
     'CAR.ORIGIN.COUNTRY'
     COMPUTE VAL1/A15 = FTOA(CAR.BODY.DEALER_COST, '(D10.2M)', VAL1);
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
Dan,

I know this question is not related but maybe you can help me out. Once I convert these numbers I then TRIM trailing zeros.

 
DEFINE FILE CAR
VAL1/D12.3=52.000;
END

TABLE FILE CAR
PRINT 
     COMPUTE VAL2/A7 = FTOA(VAL1,'(D12.3)',VAL2);
     COMPUTE VAL3/A7 = TRIM('T',VAL2,25,'0',1,VAL3);
END


This will TRIM trailing zeros but then it leaves a period on the end of the number. I then try to TRIM the period but it doesn't work. I can't use STRREP because then it will take the period out of the string entirely which I don't want to do if the value is something like 1.2

I have also tried STRIP but it will then do the same thing as STRREP without replacing the character.

Any ideas?

Thanks,

Dave


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML
 
Posts: 71 | Location: Kingston, ON | Registered: May 03, 2011Report This Post
Virtuoso
posted Hide Post
Why not remove the decimals in the FTOA output format?

DEFINE FILE CAR
 VAL1/D12.3 WITH COUNTRY = 52.000 ;
END

TABLE FILE CAR
 PRINT VAL1
       COMPUTE VAL2/A15 = FTOA(VAL1,'(D12)',VAL2);
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Gold member
posted Hide Post
I can't remove all the decimals. The values could be 51.204 or 25.000 or any other combination and I need to show the decimal values if they are not all zeros. I figured out a way using an IF statement. Thanks for the help.

Dave


WebFOCUS 7.7.03
Windows Web Server 2008
MS SQL Server 2000
Excel,CSV,PDF,HTML
 
Posts: 71 | Location: Kingston, ON | Registered: May 03, 2011Report This Post
Virtuoso
posted Hide Post
Here's a link to a previous post that might be helpful:

Removing trailing zeroes after decimal point


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report 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]Converting Packed-Decimal to Alphanumeric

Copyright © 1996-2020 Information Builders