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     Amazing bug in an -IF instruction

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Amazing bug in an -IF instruction
 Login/Join
 
Gold member
posted
Hi,

I tried to make a simple comparaison like this :

 
-IF '-' EQ '+' THEN GOTO :ADDFEES;  
-SET &VAR1 = 10;
-GOTO :ENDFEES
-:ADDFEES
-SET &VAR1 = 20;
-:ENDFEES
-TYPE VAR1 = &VAR1


And as a result I have :
VAR1 = 20

Does somebody know this bug?

PS: I tested with the 7.6.4 version and I become the same wrong result...

This message has been edited. Last edited by: Jérény Deidda,


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 2007Report This Post
<ludo>
posted
Hello everybody,

Just try to put a \ character before the +

Dr Nick
 
Report This Post
Master
posted Hide Post
DM variables are all stored as strings and their type is determined at runtime by parsing the data according to the operator.

Thus depending on the operator concerned
' 1234.56 ' can be a string or a double precision number

Example: the equality operator attempts to convert both sides to numbers where possible so

' 1234.56 ' EQ '1234.56' will be true.

This is the behaviour in your case. WebFOCUS assumes '+' and '-' are numbers (incorrectly) and converts both to zero.

To ensure an alphanumeric operand in any test concatenate a blank

eg instead of
-IF &A EQ &B THEN ...

do

-IF &A | ' ' EQ &B | ' ' THEN ...

Painful I know. In retrospect dm variables may have been better with types but that would make them less flexible but less confusing!



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Virtuoso
posted Hide Post
There is an easier and more robust way to do this kind of equations in DM.
Use the ASIS functions like:
-IF ASIS('-') EQ ASIS('+') THEN GOTO :ADDFEES;


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
Thx for all these explanations.


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 2007Report This Post
Master
posted Hide Post
GamP

You're right ASIS would be the correct way to do this but it does not work in subroutine arguments when you want to force an alpha, that's why I stick to blank concat cos it always works.

Regards

John



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Gold member
posted Hide Post
Another bug:

 
-SET &TEST = 0-0.1;
-TYPE &TEST
 


I become 0 instead of -0.1. Why?


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 2007Report This Post
Gold member
posted Hide Post
Integer minus decimal is integer...


PROD: WebFOCUS 7.1.0 on Linux/Tomcat 5.5.12 (standalone)/Informix on AIX
TEST: WebFOCUS 7.1.3 on Linux/Tomcat 5.5.16 (standalone)/Informix on AIX
 
Posts: 53 | Location: Montreal,Quebec,Canada | Registered: February 13, 2006Report This Post
Gold member
posted Hide Post
I tried 0.1 - 0.2 and the result is the same.


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 2007Report This Post
Master
posted Hide Post
Problem is resolved by a setting in 7.6. Prior releases have rounding of results to integer. If you need to retain the precision multiply by a power of 10.

Try 100 * (0.32 - 0.13) should be 19.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
 
Posts: 888 | Location: Airstrip One | Registered: October 06, 2006Report This Post
Gold member
posted Hide Post
The problem is that I don't know the precision before making the subtraction. Another idea?

Furthermore, I tried this:
  
-SET &TEST = 19/100;
-TYPE &TEST 
-QUIT


The result is always WRONG : 0 instead of 0.19

This message has been edited. Last edited by: Jérény Deidda,


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 2007Report This Post
Expert
posted Hide Post
Jérény,

Amper variables have always been dealt with as alphanumeric or integer. So what you are experiencing is not a bug.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
The best approach is to use FTOA:
-SET &TEST = FTOA(0.32 - 0.13, '(F8.2)', 'A8');
-TYPE &TEST 

-SET &TEST = FTOA(19/100, '(F8.2)', 'A8');
-TYPE &TEST 

until you get 7.6 and use the DMPRECISION setting.
As Tony says, not a bug, but expected behavior.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Gold member
posted Hide Post
OK thanks for this solution.

I called IBI support and an employee told me that the best way is to avoid making operations with th SET command and to make that in a DEFINE FILE or in a TABLE FILE when it's possible.


WebFOCUS 7.6.4 running on Windows
Output formats : PDF, Excel and HTML
My blog
 
Posts: 61 | Location: Luxembourg | Registered: October 31, 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     Amazing bug in an -IF instruction

Copyright © 1996-2020 Information Builders