Performing right() fn with "+" addition

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Performing right() fn with "+" addition

Post by venkycool »

I am deriving an aggregation column which is a_pay (decimal 11, 2) and writing to a transformer apay (char 12) with the below derivation.

"+":Right("00000000000" : DecimalToString(NullToZero(a_pay) * 100,"suppress_zero") , 11)

Somehow, I am getting "+.0000000001" to the output instead "+0000000001". Why do I get "." after the +. Any suggestions.

I have the similar derivation for the rest of 5 columns, 2 columns behave like this and others seems to be fine.

Any suggestions? inputs? Please let me know for further questions.

Thanks in Advance
Suriv
No one is perfect... that's why pencils have erasers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What's the actual value in a_pay (or similar) for the columns that work and the columns that don't work?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

ray.wurlod wrote:What's the actual value in a_pay (or similar) for the columns that work and the columns that don't work? ...
a_pay has +000150000 and I am mapping a_pay to apay with the above said derivation

Note: a_pay is different data now since I mock up test bills. Still there should not be +.00000150000
Suriv
No one is perfect... that's why pencils have erasers
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Are you certain of the value of a_pay? What is the result of just DecimalToString(a_pay) without any of the other logic?
- james wiles


All generalizations are false, including this one - Mark Twain.
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

jwiles wrote:Are you certain of the value of a_pay? What is the result of just DecimalToString(a_pay) without any of the other logic?
Yes the value is certain. I didnt try just DecimalToString. Is there any possibility with the logic I could remove the "." if it comes?
Suriv
No one is perfect... that's why pencils have erasers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

If it's varchar, then use Convert() for removing the '.'.
pandeeswaran
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

pandeesh wrote:If it's varchar, then use Convert() for removing the '.'.
It's Char. But can try varchar. Any other suggestions?
Suriv
No one is perfect... that's why pencils have erasers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Please try

Code: Select all

Convert(".","",VALUE)
and let us know.
pandeeswaran
dsusersaj
Premium Member
Premium Member
Posts: 160
Joined: Mon Dec 17, 2007 10:44 am

Post by dsusersaj »

I am not sure how you managed to get that '.'.

Becasue I just tried the same logic that you gave in the inital question.

My job design is Col generator (value of col1(deimal 11,2)=15000000
Then Transformer with the exact derivation
"+":Right("00000000000" : DecimalToString(NullToZero(DSLink2.col1) * 100,"suppress_zero") , 11). The output column is a char(12).


I output the result to peek. The peek dispayed

"Peek_5,0: outputcol:+00015000000"


I am running it in datastage 7.5.3 on UNIX
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

pandeesh wrote:Please try

Code: Select all

Convert(".","",VALUE)
and let us know.
It's not workng out! I am still getting "."
Suriv
No one is perfect... that's why pencils have erasers
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

pandeesh wrote:Please try

Code: Select all

Convert(".","",VALUE)
and let us know.
It's not workng out! I am still getting "."
Suriv
No one is perfect... that's why pencils have erasers
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Ray had asked for values of columns that don't work AND columns that do work as expected.

What are the data types of the columns the don't work and columns that do work? Any differences?

What warnings are you getting in the job log?

Did you say your using an Aggregator stage before a Transformer? If so, what is it doing?
Choose a job you love, and you will never have to work a day in your life. - Confucius
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

Sorry to get back late...

Actually, found a problem here..Everything works great in Dev env but The same job is not working in QA as it gives me the output with decimal with wrong data.


Any suggestions here...It is the same Oracle database for both dev and qa.

Thanks
Suriv
No one is perfect... that's why pencils have erasers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What does "not working" mean?

What's different between DEV and QA? (Hint: "nothing" is not the correct answer.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
venkycool
Participant
Posts: 59
Joined: Fri Feb 16, 2007 12:24 am
Location: USA

Post by venkycool »

I don't say nothing but can this happen?
Ray, we have our jobs which are 4 node configuration and jobs itself have some partition and re-partition within stages like Aggregator ( to sum calculations). When I run a sequence in DataStage through unix, I will have an ouput to verify the summation of records for particular record type. Now, I do see strange things in the records appearing as +.0000001 instead of correct records ie., +0000756 when I run in QA. Similarly I run the same sequence in in Dev unix box, I see the expected output as +0000756. We have the Oracle database as sourced. Both dev and qa are referred to the same database.

I have no clue why this is misbehaving. I tried re-importing still having issues in qa
Suriv
No one is perfect... that's why pencils have erasers
Post Reply