How to specify rows in a single column

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kayarsenal
Participant
Posts: 17
Joined: Mon Jan 16, 2006 2:11 pm
Contact:

How to specify rows in a single column

Post by kayarsenal »

Assuming I have an input:

1234
1234
3435
1253
3455
3534

I want some specific no to be assigned to another column if the rows are the same. In the case above, a number 1 is assigned in new col to 1234 but once it changes to 3435, it changes to 2.
I tried this :
current: DS.Colname
previous: DS.Colname
New: current<>Previous
StageVar: If New then ....................................

It would have worked but I dont know how to specify current and previous properly. I mean the first row to be previous and the next row to be current.

Thank you
ARSENAL GUNNERS GOONER
Sunshine2323
Charter Member
Charter Member
Posts: 130
Joined: Mon Sep 06, 2004 3:05 am
Location: Dubai,UAE

Post by Sunshine2323 »

Hi kayarsenal,

Input
1234
1234
3435
1253
3455
3534

Output
1,1234
1,1234
2,3435
3,1253
4,3455
5,3534

If this is the output you are expecting then look at the solution at the end of this post.
viewtopic.php?t=97751
Warm Regards,
Amruta Bandekar

<b>If A equals success, then the formula is: A = X + Y + Z, X is work. Y is play. Z is keep your mouth shut. </b>
--Albert Einstein
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi,

How about searching this forum :wink:

Try This

-Kumar[/url]
info_ds
Charter Member
Charter Member
Posts: 88
Joined: Thu Feb 10, 2005 4:36 am
Location: B\'lore

Re: How to specify rows in a single column

Post by info_ds »

Hi Kayarsenal,

A small change is to be done in your code.

current: DS.Colname
New: current<>Previous
previous: DS.Colname
StageVar: If New then ....................................

It should be in the above specified order,provided the data is already sorted.

Even this can be achieved via build-in transform funtion"RowComparewith Previous Value"

Hope this helps.

Correct me if i'm wrong.

Thanks.


kayarsenal wrote:Assuming I have an input:

1234
1234
3435
1253
3455
3534

I want some specific no to be assigned to another column if the rows are the same. In the case above, a number 1 is assigned in new col to 1234 but once it changes to 3435, it changes to 2.
I tried this :
current: DS.Colname
previous: DS.Colname
New: current<>Previous
StageVar: If New then ....................................

It would have worked but I dont know how to specify current and previous properly. I mean the first row to be previous and the next row to be current.

Thank you
kayarsenal
Participant
Posts: 17
Joined: Mon Jan 16, 2006 2:11 pm
Contact:

Post by kayarsenal »

You are right. Thanks. I tried it, but preferred the RowProcCompareWithPreviousValue.

Thanks a lot :-)
ARSENAL GUNNERS GOONER
Post Reply