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] Plus/Minus Sign Preceeding Number

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Plus/Minus Sign Preceeding Number
 Login/Join
 
Member
posted
Hi,

We currently have FOCUS 7.6.11 on the mainframe, and I was wanting to show numeric values with either the + or - sign preceeding the value. The minus sign is no problem is the number is negative, but I haven't found a way to show the plus sign in front of positive values. I need the +/- for the following code:

AND COMPUTE ABOVE_BELOW/I4C = (ALL3 - (.05 * SCOREDRCP));
AS ' CASES, ABOVE,/BELOW, 5.0%'

Thanks,

Carroll

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


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report This Post
Master
posted Hide Post
Seems like you might have to do this in 2 steps.
1 - Calculate the value as a numeric.
2 - DEFINE a variable with the value and append the plus/minus to produce an alpha value for reporting.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Member
posted Hide Post
I was trying to produce output that looked like this:

CASES
ABOVE
DAY OF SCORED /BELOW
DATE WEEK CASES PCT 5.0%
----------- ------ ------ ------ ------
07/31/2011 Sun 34 8.82% -1
08/01/2011 Mon 11,613 5.70% +81
08/02/2011 Tue 13,615 5.71% +96
------------------------------------------------

TOTAL 25,262 5.71% +176

Thanks,
Carroll


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report This Post
Member
posted Hide Post
I didn't realize the numbers would all run together. Sorry the mini-report is hard to read!

Carroll


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report This Post
Virtuoso
posted Hide Post
Would this example be of help? (the define is just to generate a negative number)
JOIN COUNTRY IN COUNTRIES TO ALL COUNTRY IN CAR AS J1
DEFINE FILE CAR
 CHAIRS/I5 = IF COUNTRY EQ 'ENGLAND' THEN -SEATS ELSE SEATS;
END

TABLE FILE CAR
 SUM SALES CHAIRS
 COMPUTE PM/A6 = IF CHAIRS LT 0 THEN '-' || LJUST(5,PTOA(ABS(CHAIRS), '(P5)', 'A5'),'A5') ELSE
                 IF CHAIRS EQ 0 THEN '0' ELSE '+' || LJUST(5,PTOA(CHAIRS, '(P5)', 'A5'),'A5');
 BY COUNTRY
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Master
posted Hide Post
I'm sure there is a faster/easier/better way to do this, but here is what I'm talking about:

DEFINE FILE CAR
	MY_VARIANCE/I8 = SALES - 1000;
	DISP_VAR2/A20   = EDIT(MY_VARIANCE);
	DISP_VAR1/A20   = TRIM('L', DISP_VAR2, 20, '0', 1, 'A20');
	DISP_VAR/A21    = IF MY_VARIANCE GT 0 THEN '+' | DISP_VAR1 ELSE IF  MY_VARIANCE LT 0 THEN '-' | DISP_VAR1 ELSE DISP_VAR1;
END

TABLE FILE CAR
PRINT
	COUNTRY 
	CAR 
	MODEL 
	SALES
	MY_VARIANCE
	DISP_VAR2
	DISP_VAR1
	DISP_VAR
END


-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Member
posted Hide Post
Thanks GamP and ABT

Carroll


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report This Post
Virtuoso
posted Hide Post
Let's think NFR. (It's about time IBI provided this)

Suggestions for how to specify this type of decoration on numeric formats:

+ suffix: P10C+ D12.2+
+ infix: D+12.2
P suffix: D12.2P

Use of "+" does not create any problem in DEFINE, COMPUTE, MFD, or final argument of a function. Even in reformatting a column in TABLE, /format never occurs within a numeric expression (else / could not be used in the first place!).

Any other suggestions?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Master
posted Hide Post
why not just expand the Packed format to work with signed values (as it already should)?

I realize that's basically what you said, I just wanted to slip in the 'As it already should' part... Wink

-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Master
posted Hide Post
Yes please.

Same 'problem' here. I'd like to explicitly add a + before positive numbers.

AND I would like to choose my own suffix. E.g. pct

( not being the PCT as used in FOCUS syntax )


_____________________
WF: 8.0.0.9 > going 8.2.0.5
 
Posts: 668 | Location: Veghel, The Netherlands | Registered: February 16, 2010Report This Post
Virtuoso
posted Hide Post
If (distant) memory serves, COBOL provides Display options for leading or trailing minus or sign (plus/minus). Obviously the business need existed, so why not fill the void?

Since using + and - in a FOCUS format does not create syntactic ambiguity, I suggest...
leading minus      :  xn or x-n (the latter just for consistency with the 3 forms below)   
leading sign (+/-) :        x+n                
trailing minus     :        xn-
trailing sign      :        xn+
  (where x=numeric format letter[I or P or D or F], and n=their numeric format spec)
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Member
posted Hide Post
I agree that this should be a numeric display option. I realize that even with the excellent coding examples, there are still other issues, such as, the complexity of adding a comma for numbers over 999, and coming up with an alpha replacement for a recompute.

Thanks for the discussion. I appreciate the input.

Carroll


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report This Post
Virtuoso
posted Hide Post
You might be able to use this trick from previous Forum posts. Set the currency symbol to '+' and then dynamically set the output format to display/hide the currency symbol based on whether the value is positive or negative.

TABLE FILE CAR
 PRINT
  COMPUTE AMOUNTX/D8 = IF (COUNTRY LIKE 'IT%' OR 'JA%') THEN RETAIL_COST ELSE (-1 * RETAIL_COST); NOPRINT
  COMPUTE FORMATX/A8 = IF (AMOUNTX LT 0) THEN 'D8' ELSE 'D8M'; NOPRINT
  AMOUNTX/FORMATX
 BY CAR
 ON TABLE SET CURRSYMB '+'
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
Thanks Dan.

Carroll


FOCUS 7.6.11 for Mainframe
z/OS - DB2 & Flat Files
Developer Studio 7.6.4
Windows XP Professional SP 2
Output: Excel, PDF
 
Posts: 10 | Location: Baltimore, MD | Registered: March 30, 2007Report 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] Plus/Minus Sign Preceeding Number

Copyright © 1996-2020 Information Builders