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.
First when posting sample code or result, please use the code tag. It's the last icon on the ribbon :
</>
Secondly, what is the COL1 & COL2 format ? That can make the whole difference. Thirdly, are you 100% sure that COL1 & COL2 have the sample value you shown us ? Fourth, always a good idea trying to reproduce with IB file such as CAR Fifthly, always a good idea to share your code
WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF In Focus since 2007
Posts: 2409 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013
Is D20S the ACTUAL or USAGE format? D20S as a USAGE format should only print the integer portion of the value. The one thing to keep in mind with F and D formats is that internally (memory and FOCUS file) they store every significant digit. So if COL1 is a computed field or a field in a FOCUS/XFOCUS file, -846.50 is really -846.50000001, which is why you are getting the result your are getting. Try the following:
DEFINE FILE CAR
VAL1/D20S WITH COUNTRY=-846.50000001;
END
TABLE FILE CAR
PRINT VAL1 VAL1/D20.8S
COMPUTE VAL2=VAL1;
COMPUTE VAL3/D20.2S=VAL1;
COMPUTE VAL4/D20.8S=VAL1;
COMPUTE VAL5/D20.8S=VAL2;
IF COUNTRY EQ 'ENGLAND'
END
In this example, you can see how VAL1 with a D20 format (no decimal) really stores all the significant digits and what is printed is based on the USAGE format. Notice VAL2. If a variable is given no format, the default field format is D and the default USAGE is D12.2. When doing computations with D fields, what is used in the internal value not the "USAGE" value.
In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006
Conver the field to Packed Decimal instead of Decimal. That will round the values and hold it. I have just changed the format of Define Field from D to P
DEFINE FILE CAR
VAL1/P20S WITH COUNTRY=-846.50000001;
END
TABLE FILE CAR
PRINT VAL1 VAL1/D20.8S
COMPUTE VAL2=VAL1;
COMPUTE VAL3/D20.2S=VAL1;
COMPUTE VAL4/D20.8S=VAL1;
COMPUTE VAL5/D20.8S=VAL2;
IF COUNTRY EQ 'ENGLAND'
END
WF 8.2.04 Windows/Unix All Formats In Focus since 2006
Posts: 74 | Location: UK | Registered: September 17, 2018