Number Calculation

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

Post Reply
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

Number Calculation

Post by dssiddu »

hi all

How to calculate this one. i mean after every number(not 0) equals Number+Number of Zeros in front of it.
For Ex: 3= 1+2 Zeros
4= 1+3 Zeros.

0
0
1
1
3
0
0
1
1
4
0
0
0
Thanks in Adv......
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Odd. Are you looking for one total, a running total, or ?? It's not clear what you need, can you post the output for your sample input?
-craig

"You can never have too many knives" -- Logan Nine Fingers
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

Post by dssiddu »

hi

that 1 output only.... here plz refer....

i/p o/p
0 0
0 0
1 1
1 3
0 0
0 0
1 1
1 1
1 4
0 0
0 0
0 0
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

dssiddu - The second example makes it even more confusing than the first. "the number of zeroes before it" is not understandable as a rule since line 3 and line 4 both have 2 zeroes before. Could you explain the derivation logic in a bit more detail, please?
dssiddu
Participant
Posts: 66
Joined: Mon Nov 07, 2005 10:28 pm
Contact:

Post by dssiddu »

hi

nothing much

i/p : 11100111000110

O/p should be : 11300114000120
Here we add number of zeros in front of 1 and +1 to that . thats it. Hope it clear now..
Thanks a lot for u r replay
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The example and the text are incompatible. I would expect something like:

Code: Select all

Input:    11100111000110
Zeroes:   00000200000300
Output:   11100311000410
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

dssiddu wrote:hi

nothing much

i/p : 11100111000110

O/p should be : 11300114000120
Here we add number of zeros in front of 1 and +1 to that . thats it. Hope it clear now..
Thanks a lot for u r replay

Ok, You have posted 3 examples with two meanings.

Can you please tell its the value of one cell or values are in different rows?
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply