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.
Sorry guys. I never professed to be a teacher. I was just giving another example of how it could be accomplished. I guess I should have broken it out for those that like to see the fields built one at a time.
Maybe this helps:
DEFINE FILE CAR TAX/D12.4 = .08125; SALESTAX/D12.4 = RETAIL_COST * TAX; -*MULTIPLY SALESTAX BY 100 AND CONVERT TO ALPHA FTOA_SALESTAX/A14 = FTOA(SALESTAX*100, '(D12.2)', 'A14'); -*FIND THE POSITION OF THE DECIMAL POSIT_DECIMAL/I2 = POSIT(FTOA_SALESTAX, 14, '.', 1, 'I2'); -*USE SUBSTR TO KEEP EVERYTHING TO THE LEFT OF THE DECIMAL SUBSTR_SALESTAX/A14 = SUBSTR(14, FTOA_SALESTAX, 1, POSIT_DECIMAL-1, 14, 'A14'); -*REMOVE THE COMMAS STRIP_SALESTAX/A14 = STRIP(14,SUBSTR_SALESTAX, ',', 'A14'); -*CONVERT BACK TO NUMERIC AND DEVIDE BY 100 TRUNC_SALESTAX/D12.2 = EDIT(STRIP_SALESTAX)/100; END
TABLE FILE CAR PRINT RETAIL_COST TAX SALESTAX TRUNC_SALESTAX COMPUTE DRIVEOUT/D12.2 = RETAIL_COST + TRUNC_SALESTAX; ON TABLE PCHOLD FORMAT EXL2K END -EXIT
DEFINE FILE CAR
VAL1/D12.4 WITH CAR = 3456.7891 ;
VAL2/D12 = INT(VAL1);
VAL3/D12.4 = VAL1 - VAL2;
END
TABLE FILE CAR
PRINT VAL1 VAL2 VAL3
IF RECORDLIMIT EQ 1
END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
Althought the solution Glenda posted works I think it is far to complex. The available formats give you the posibility to do this in a more mathematical way.
And just to show you the difference I would suggest to rus this small program and see ...
DEFINE FILE CAR
VAL1/D12.5=1234.5678;
VALUPDEC/D12.2=VAL1;
VALUPPACK/P12.2=VAL1;
VALDOWNDEC/D12.2=VAL1-.005;
VALDOWNPACK/P12.2=VAL1-.005;
END
TABLE FILE CAR
PRINT
COUNTRY
VAL1
VAL1/D12.2
VALUPDEC
VALUPDEC/D12.5
VALUPPACK
VALUPPACK/D12.5
VALDOWNDEC
VALDOWNDEC/D12.5
VALDOWNPACK
VALDOWNPACK/D12.5
ON TABLE SET PAGE-NUM OFF
ON TABLE COLUMN-TOTAL
END
And suppose you have a negativ number that should be rounded up or down...would you use Glenda's solution?
BTW please update your signature....!
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, 2006
I agree with Frank - there are a lot of ways to do this, but using the 'P' format has been my preferred method because of it's simplicity - no functions and very simple format redefinition (which can be done without a DEFINE in many cases.
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, 2007