Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
sudhaaa

New User

Joined: 24 Mar 2005
Posts: 51

 Posted: Fri Oct 26, 2007 5:28 pm    Post subject: Regarding char(decimal) Hi, Can you please let me know how below expression will work CHAR(SUM(INTEGER(DECIMAL((0.03*0.03),17,6)/DECIMAL((0.03*0.03),17,6)-0.001) ))) When I tried it is giving junk values...

Craq Giegerich

Senior Member

Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

 Posted: Fri Oct 26, 2007 5:33 pm    Post subject: What are you trying to accomplish?
sudhaaa

New User

Joined: 24 Mar 2005
Posts: 51

 Posted: Fri Oct 26, 2007 7:42 pm    Post subject: I need to fix above problem, which happend in live. I treid with other values in place of 0.03 (with 126.25), where it is giving correct result But when I tried with 0.03, it is giving junk values. Hence need to analyze on why it's giving junk values for 0.03
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

 Posted: Fri Oct 26, 2007 8:41 pm    Post subject: what exactly are these junk values?
sudhaaa

New User

Joined: 24 Mar 2005
Posts: 51

 Posted: Sat Oct 27, 2007 1:30 pm    Post subject: I am really sorry to say, do you really need what junk values it is giving to explain above one
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

 Posted: Sat Oct 27, 2007 4:31 pm    Post subject: I am ready to say that anyone who describes output from anything as 'JUNK' is in a really sorry situation. It appears that you don't know very much. The sql contains no columns or host-variables. Why are you using all these column functions? integer, decimal etc. when you cast as integer, you lose your decimal positions (i.e. values between .999999999999999 and .0000000000001. and the reason that I wanted to know what the 'junk' was, is that I understand what the computer does when it executes, thus I could have worked backwards to see why your results are different when you use a value greater than 1 (as apposed to less than 1). but, you seem to know it all (instead of simply answering my question, you give me a BS response). hope someone else has patience and will help you. have a good weekend.
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10457
Location: italy

Posted: Sat Oct 27, 2007 5:09 pm    Post subject: Reply to: Regarding char(decimal)

wow...

integer( (x*x) / ( (x*x) - 0.001)
wasting bandwitdh for a computation that will always yield a 0 or a 1
given the appropriate number of decimal digits

 Quote: I am really sorry to say, do you really need what junk values it is giving to explain above one

I agree that refusing to tell what the junk is he is safeguarding
confidential info

I would had done the same
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

Posted: Sat Oct 27, 2007 5:46 pm    Post subject:

what in the world could be confidential about this garbage or the 'output' of this SQL execution? It looks like to me that the sql is summing a bunch of integers.

 Code: CHAR(SUM(INTEGER(DECIMAL((0.03*0.03),17,6)/DECIMAL((0.03*0.03),17,6)-0.001) )))

 Code: CHAR(     SUM(         INTEGER(             DECIMAL(                  (0.03*0.03),17,6             )           /             DECIMAL(                 (0.03*0.03),17,6             )           -0.001         )     ) ) )

there are no host variables, there are no columns. The is nothing except literals and column functions.

There is no such thing as 'junk' as output. It may not be what 'you want', but the computer only does what you tell it to do by means of your code (be it JCL, cobol programs, SQL). The computer is not a person; it can not determine what you 'wanted' - only what you told it todo. So, since computers are predictable, you can trace a result backwards thru the code that was executed and determine the original input.

So, this silliness about confidential info does not apply here. And even if it did, the OP could have stated so instead of providing a childish response.
sudhaaa

New User

Joined: 24 Mar 2005
Posts: 51

 Posted: Mon Oct 29, 2007 4:44 pm    Post subject: Reply to: Regarding char(decimal) Thanks and Bye to this group
enrico-sorichetti

Global Moderator

Joined: 14 Mar 2007
Posts: 10457
Location: italy

Posted: Mon Oct 29, 2007 4:57 pm    Post subject: Reply to: Regarding char(decimal)

 Quote: Thanks and Bye to this group

Thanks for what ??
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us