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.
We have been messing with this all day, thinking there has to be a better way to strip zeros and trailing spaces from an Integer that's been converted to an alpha.
This is the best we could come up with.
We use PTOA so it doesn't create the preceding zeros. We use STRREP to strip off the preceding spaces, then have to use TRUNCATE to remove the trailing spaces. What a task.
SET ASNAMES=MIXED
-DEFAULTH &MULTIPLIER = 13713;
-DEFAULTH &MYCNT = _FOC_NULL;
TABLE FILE CAR
SUM
COMPUTE MYCNT/A11V = STRREP(11, PTOA(CNT.DST.COUNTRY*&MULTIPLIER, '(P11)', 'A11V'), 1, ' ', 0, '', 11, MYCNT);
ON TABLE HOLD AS MYHOLD FORMAT INTERNAL
END
-RUN
-READFILE MYHOLD
-SET &MYCNT = TRUNCATE(&MYCNT);
-TYPE MYCNT = ->&MYCNT<-
END
Is it me or is the 100x harder than it should be based on any other language out there. We are unsure why IBI auto pads and creates preceding zeros.This message has been edited. Last edited by: GavinL,
- FOCUS Man, just FOCUS! ----------------------------- Product: WebFOCUS Version: 8.1.04 Server: Windows 2008 Server
If you happen to know what the length of your integer will be it gets a lot simpler. In your example the length is 5 and as loing as the first COMPUTE has a length of 5 it doesn't appear to matter what you use as the length for the alpha field - although obviously you would want them the same.
I don't know if there is a way to figure out what the length of an integer is dynamically.
TABLE FILE CAR
SUM
COMPUTE GP/I5 = CNT.DST.COUNTRY*&MULTIPLIER;
COMPUTE GP2/A5=EDIT(GP);
END
Or (better) you can use a double precision number as the first COMPUTE and the FTOA in the second. Note the lower case c in the second parameter which removes the comma
TABLE FILE CAR
SUM
COMPUTE GP/D10 = CNT.DST.COUNTRY*&MULTIPLIER;
COMPUTE GP3/A10=FTOA(GP, '(D10c)', 'A10');
END
We use LJUST instead of STRREP for this particular purpose. And sometimes we use FPRINT instead of PTOA, but that doesn't make a lot of difference:
-DEFAULTH &MULTIPLIER = 13713;
TABLE FILE CAR
SUM
COMPUTE MYCNT/A11V = LJUST(11, FPRINT(CNT.DST.COUNTRY*&MULTIPLIER, 'P11', 'A11'), MYCNT);
END
Still not very convenient, but perhaps a small improvement.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :