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     [CLOSED] rounding (not)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] rounding (not)
 Login/Join
 
Gold member
posted
This should be easy but I seem to be making it hard.

I have a numeric value described in the MFD like this:

FIELDNAME=TGPA_GPA, ALIAS=TGPA_GPA, USAGE=D20.2, ACTUAL=D8,

The value is 2.986232. I need it to display as 2.98 2.99 seems to be all I can get because I don't know how to suppress the rounding.

I've tried converting to alpha but still can't get it.

Any help would be greatly appreciated.

Steve

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


Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
 
Posts: 64 | Location: Eastern and middle NC | Registered: March 13, 2007Report This Post
Virtuoso
posted Hide Post
Use INT to truncate:
DEFINE FILE CAR
TGPA_GPA/D20.2=2.986232;

TGPA_GPA2/D12.2=INT(TGPA_GPA*100)/100;

END
TABLE FILE CAR
PRINT TGPA_GPA TGPA_GPA2
BY COUNTRY
END
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Virtuoso
posted Hide Post
I was just about to post when my browser refreshed and I saw the EXACT code I was posting in j.gross's post. So I won't repeat. Any format/precision conversion you do is going to automatically round and I don't think there is any way around it except truncating the number as suggested.


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
An other solution could be

DEFINE FILE CAR
TGPA_GPA/D20.2=2.986232;

TGPA_GPA2/D12.2=TGPA_GPA-0.00499;
END

TABLE FILE CAR
PRINT TGPA_GPA 
TGPA_GPA2
BY COUNTRY
END




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Virtuoso
posted Hide Post
Tom

2.983232 minus 0.004999 is 2.978233 presented as D12.2 is 2.98....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Expert
posted Hide Post
I use Frank's way .. works just dandy for me.
Citibank keeps all the extra mils that way.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
Thanks to all who replied. True, 2.985232 will properly round to 2.99 but my customer specifically requested two decimal places and no rounding. So, both J.Gross and FrankDutch provided simple one-line working solutions. I actually came up with some code that worked but I'd be embarrassed to post it here! Of course I've only been writing FOCUS at the code level for twenty years so I'm a little new at this. Thanks again.

Steve


Dev Studio /7.6.11/7.7.02M
MVS/USS
AIX/SOLARIS
Windows WF Client 7.6.8/7.6.11
 
Posts: 64 | Location: Eastern and middle NC | Registered: March 13, 2007Report This Post
Platinum Member
posted Hide Post
Steve, as Susannah said, I would so use Frank's method - that has worked well for me over the years, but if you want 2 decimal places and no rounding here goes:
quote:
DEFINE FILE CAR
ORIG_VALUE/D20.2=2.986232;
FLD0/D20.2 = ORIG_VALUE * 100 ;
IVAL/I4 = IMOD(FLD0, 1000, IVAL);
AVAL/A6=EDIT(IVAL,'$9.99');
DVAL/D20.2=ATODBL(AVAL, '6', DVAL);
END

TABLE FILE CAR
PRINT ORIG_VALUE FLD0 IVAL AVAL DVAL
BY COUNTRY
END
-EXIT

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


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
 
Posts: 195 | Registered: October 27, 2006Report 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     [CLOSED] rounding (not)

Copyright © 1996-2020 Information Builders