Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Regarding char(decimal)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Fri Oct 26, 2007 5:28 pm    Post subject: Regarding char(decimal)
Reply with quote

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...
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


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

PostPosted: Fri Oct 26, 2007 5:33 pm    Post subject:
Reply with quote

What are you trying to accomplish?
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Fri Oct 26, 2007 7:42 pm    Post subject:
Reply with quote

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
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri Oct 26, 2007 8:41 pm    Post subject:
Reply with quote

what exactly are these junk values?
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Sat Oct 27, 2007 1:30 pm    Post subject:
Reply with quote

I am really sorry to say, do you really need what junk values it is giving to explain above one
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Oct 27, 2007 4:31 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10277
Location: italy

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

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
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Oct 27, 2007 5:46 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
sudhaaa

New User


Joined: 24 Mar 2005
Posts: 51

PostPosted: Mon Oct 29, 2007 4:44 pm    Post subject: Reply to: Regarding char(decimal)
Reply with quote

Thanks and Bye to this group
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10277
Location: italy

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

Quote:
Thanks and Bye to this group


Thanks for what ??
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Convert Decimal to hexadecimal Steve Ironmonger DFSORT/ICETOOL 5 Fri May 27, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. JCL to convert float decimal into rea... polymathtarun JCL & VSAM 3 Sun May 15, 2016 9:57 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us