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     Wrong result with ATODBL function

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Wrong result with ATODBL function
 Login/Join
 
Gold member
posted
Hi,

I'm trying to convert an alphanumeric variable to a double precision format variable with the ATODBL function but there is a problem: I always become 0.00000 as result.

TABLE FILE OPP020
PRINT 
     O20TXUNITE
     O20ACOURS1
COMPUTE CHANGE/D14.7 = ATODBL('&MYVAR.EVAL','14',CHANGE);
END  


THE &MYVAR variable is the result of this:

-READ TABDEVPF &MYVAR.14  


In the master file, MYVAR is P14.7

Thanks for your help,

Jérémy.


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
Virtuoso
posted Hide Post
quote:
In the master file, MYVAR is P14.7


Which isn't alpha which is what ATODBL is supposed to have as input. It returns zero if it doesn't like the input.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
-SET &ECHO=ALL;
-SET &MYVAR = 2912.12234;

TABLE FILE CAR
PRINT 
COMPUTE CHANGE/D14.7 = ATODBL('&MYVAR','&MYVAR.LENGTH',CHANGE);
COUNTRY
END


The length (second parameter for ATODBL) must be exactly the length of the data in the variable - the best way to to do this is to use &var_name.LENGTH.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
&vars are not classified as alpha or numeric. If the value contains 100 you could use it in either expression below without having to change any formats.

WHERE CODE EQ '&var';

OR

WHERE COUNTER GE &var;

The exception would be for dates. If it contains a value which will be compared as or used in further DATE computations, it needs to be converted to a smart date.

The use of quote marks tells the expression whether it is to be used as alpha or numeric.

You should just be able to say
COMPUTE CHANGE/D14.7=&MYVAR ;


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
Expert
posted Hide Post
Why didn't I think of that?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thanks Leah and Francis,

I replaced '14' by '&CHGDEVREF.LENGHTH' but it's always the same result : 0,0000000.

I think the problem is that the input format is alpha (' 0,6318400') and not 0,6318400 like your sample.

Another idea?


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
quote:
Originally posted by Darin Lee:
&vars are not classified as alpha or numeric. If the value contains 100 you could use it in either expression below without having to change any formats.

WHERE CODE EQ '&var';

OR

WHERE COUNTER GE &var;

The exception would be for dates. If it contains a value which will be compared as or used in further DATE computations, it needs to be converted to a smart date.

The use of quote marks tells the expression whether it is to be used as alpha or numeric.

You should just be able to say
COMPUTE CHANGE/D14.7=&MYVAR ;


And so what can I do? If I try this:

  
TABLE FILE OPP020
PRINT 
     O20TXUNITE
     O20ACOURS1
COMPUTE CHANGE/D14.7 = ATODBL(&MYVAR,'14',CHANGE);
END  


There is this error:

(FOC275) FOCUS FUNCTION HAS INCORRECT NUMBER OF ARGUMENTS;
(FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND


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
Virtuoso
posted Hide Post
What I was saying is that there is no need to use the ATODBL function.

COMPUTE CHANGE/D14.7=&MYVAR ;
And it appears that you need to make sure the CDN setting is correct (ON)


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
Expert
posted Hide Post
I think you will have to change the "," to a "." - I don't think functions or DEFINE/COMPUTE can handle "," as the decimal separator.

SET CDN = ON/OFF/SPACE/QUOTE only works for displaying data in a report.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Not quite sure how this worked for the other side of the pond.


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
Gold member
posted Hide Post
Thanks Darin,

the problem is solved.


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
How?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report 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     Wrong result with ATODBL function

Copyright © 1996-2020 Information Builders