Page 2 of 2

Re: Need query to change packed decimal to decimal

PostPosted: Thu May 19, 2011 10:38 am
by enrico-sorichetti
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

Re: Need query to change packed decimal to decimal

PostPosted: Thu May 19, 2011 11:11 am
by enrico-sorichetti
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

Re: Need query to change packed decimal to decimal

PostPosted: Fri May 20, 2011 12:30 pm
by vishnusrini
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.