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] Help on Packed to Alpha numeric Conversion and EDIT function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Help on Packed to Alpha numeric Conversion and EDIT function
 Login/Join
 
Member
posted
Hi,

Can you please help on this following problem.

I have Field called UNIT_CODE; this Field is a Packed Decimal P12.

I would like to convert this Field to Alpha numeric (A10)in order to concatenate with other field that has an A4.

So I did the Following changes in my Define File

TUNIT/A15 = FTOA(UNIT_CODE,'(D12)',TUNIT);

In My output I saw the Field is converted into A14, Like Below,

10,020,313,480 ,

but it is comma separated

I wanted to remove the comma’s to get the Values like 10020313480.

So I did the following decode in my define,

KEY_UN/A10 = EDIT(TUNIT,'99$999$999$99');

But I am getting a output like this 1, 02,31,4

My comma's are not removed and some zeros are truncated

Attached below is my final output

any help is appreciated

UNIT_CODE TDELR TUNIT KEY_UN
--------- ----- ----- ------
10020313480 400145 10,020,313,480 1,02,31,4
1

This message has been edited. Last edited by: Kerry,
 
Posts: 6 | Location: Toronto. | Registered: January 31, 2007Report This Post
Guru
posted Hide Post
Have you considered PTOA ie Packed to Alpha?
If the commas persist then the STRIP function.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Expert
posted Hide Post
If you specify the format in the PTOA function as P12, you will not get commas.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
quote:
D12

Waz is correct as it is a packed field you should be using PTOA not FTOA.

Having said that when you actually do need to convert a double and do not want the commas the the format should be D12c
(the lowercase c means no commas whereas a C uppercase means add commas which is the default for double numerics)
 
Report This Post
Platinum Member
posted Hide Post
Try a search on "PTOA" which will allow you to convert the Packed Zoned Decimal field to Alpha...Hope this helps.


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
 
Posts: 130 | Location: Columbus, Ohio | Registered: February 25, 2009Report This Post
Member
posted Hide Post
Thanks Very much for everyone who helped me on this issue.

Before trying PTOA and STRIP Function, I just Reduced 1 decimal in the FTOA Fucntion like below
instead of
TUNIT/A15 = FTOA(UNIT_CODE,'(D12)',TUNIT);

I did the following changed in the FTOA

TUNIT/A15 = FTOA(UNIT_CODE,'(D11)',TUNIT);

It worked.

Thanks again for all your help. I really appreciate your help
 
Posts: 6 | Location: Toronto. | Registered: January 31, 2007Report This Post
Virtuoso
posted Hide Post
I would not be too comfortable with that solution - especially since you are using FTOA to convert a packed decimal number. If you ever got a larger or smaller number in unit code, it may not work.

But then again, I have also run across solutions that always work for some inexplicable reason contrary to what logic dictates. Isn't WF great?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Raja,

You can bypass the use of EDIT as follows:
  
TUNIT/A15 = FTOA(UNIT_CODE,'(D12c)',TUNIT); 

The small "c" takes away the commas.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Master
posted Hide Post
Darin isn't the only one who thinks you may be courting trouble with that solution. If you are running on an UNIX or Windows server then you might not encounter a problem, but even then I would convert the number to a D12c before using FTOA.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
<JG>
posted
quote:
I would convert the number to a D12c before using FTOA.


D12 = D12c = D12M = D12B = D12L = D12etc. etc.

All edit options are just that they are applied at display time and do not affect
the internal storage of the data.

What really gets at me though is that PTOA and FTOA still only support values up to 15 digits

When D supprts 20 and P supports 32 the functions should as well.

This message has been edited. Last edited by: <JG>,
 
Report This Post
Expert
posted Hide Post
I can't find any reference to the maximum size of the Packed field in PTOA. Just did a test with the number 1234567890123456789012345678901.

It worked, but adding a 2 to the end made it fail.

Do you have examples of PTOA failing above 15 digits ?

We are using it on number up to P20.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
<JG>
posted
quote:

Syntax: How to Specify a Packed-Decimal Format
Pm.n
where:

m
Is the maximum number of characters to be displayed, up to a maximum of 33 positions (which include a position for the sign and decimal place). The default length is 12.2.

n
Is the number of digits that will follow the decimal point. It can be up to 31 digits.



32 Plus sign
 
Report This Post
Master
posted Hide Post
quote:
D12 = D12c = D12M = D12B = D12L = D12etc. etc.


JG
You seem to have missed my point. The format of the original number is P12. I would convert it to a D12 before using FTOA or use PTOA (which might not be available depending on the release).


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
If my memory serves correctly, I used PTOA in 2004 in one of the 5.3.x releases. It was NOT documented then, of course.


jimster06
DevStu WF 7.6.11
W7
HTML, PDF, EXL2K
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report 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] Help on Packed to Alpha numeric Conversion and EDIT function

Copyright © 1996-2020 Information Builders