Query to change packed decimal to decimal



IBM's flagship relational database management system

Re: Need query to change packed decimal to decimal

Postby enrico-sorichetti » Thu May 19, 2011 10:38 am

repeated sextillions times around here ...
jcl does nothing, jcl does nothin, jcl does nothing
it simply, based on the jcl statements provided,
sets up the proper environment for program execution


what You posted up to now is pretty useless
You just kept/keep repeating
that the output produced by <some unknown program> is not according to Your/Your client expectations

if <some unknown program> does not provide what the idiots want
those same idiots should be satisfied by what <some unknown program> provides
or realize that somebody must write a program to satisfy their requirement

or use a two step approach ,
extract the data
reformat using some other program/utility , NOT JCL
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Re: Need query to change packed decimal to decimal

 

Re: Need query to change packed decimal to decimal

Postby enrico-sorichetti » Thu May 19, 2011 11:11 am

or .... follow on after recalling some reminescences

since You got part of the wanted result by using SELECT CHAR(CAST(AMOUNT_A AS DECIMAL(18,2)))

1) evaluate better training for Your client and Your organization for proper terminology

2) and/or evaluate better training on db2/sql functionality

3) and/or after 2) evaluate the use of a SELECT using the CASE construct along the lines of
select the use of a case statement to provide proper formatting
CASE
  WHEN AMOUNT_A >= 0 THEN  "+" <concatenation operator> CHAR(CAST(AMOUNT_A AS DECIMAL(18,2)))
  ELSE CHAR(CAST(AMOUNT_A AS DECIMAL(18,2)))
END


long time since dealing with db2/sql minutiae ( small/irrelevant details )
but the overall logic should be ok

the harsh/strong reply that many of You are getting are not bad manners
but a way of trying to <stimulate> Your neurons for better brain activity
to learn how to post properly
how to use proper terminology
how to search for solutions Yourself
hot to pose questions in a way to make people eager to reply

if the question is uninteresting, badly posed ,
... chances of getting a good reply or a reply at all will be slim

using really bad terminology ( like in this case )
asking question that could find an answer by <googling> or doing a bit of homework
... will simply get You bashed and yelld at :D

it would be wise to read and meditate on
How To Ask Questions The Smart Way here
http://catb.org/~esr/faqs/smart-questions.html
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2643
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times

Re: Need query to change packed decimal to decimal

Postby vishnusrini » Fri May 20, 2011 12:30 pm

I tried with replace command, it is working fine. but it is taking more CPU time.

CHAR(REPLACE(CHAR(CAST(ACCUM_A AS DECIMAL(18,2))),' ','+'))

thanks for all your help.
vishnusrini
 
Posts: 32
Joined: Wed Jul 07, 2010 2:55 pm
Location: India,bangalore
Has thanked: 0 time
Been thanked: 0 time

Previous

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post