Problems changing rows in column

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
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Problems changing rows in column

Post by sylvan_rydes »

Hi All,

I have this problem as described below-

I have input records as below:
P Q (P and Q are column names)
1. A
2. B
3. C
4. D
5. E
6. F

Now I need output like

W X Y Z (W, X, Y and Z are column names)
1. A B C
2. D E
3. F ..

Any help will be appreciated. Thanks in advance.

Sylvan Rydes
sylvan rydes
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi,
I think you can use Row merger active plugin stage. You can do a search in the forum, you will get more info. And move this post to server.This is a server job
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Rows into columns huh, that sounds like a job for the pivot stage. Look into the pivot stage along with the row merger.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, the requirement is for a vertical pivot. The Pivot stage only does horizontal pivots.

I can not see any logic in the example for determining which rows accumulate into columns. Did you give erroneous values for the P column?

Search the forum for "Vertical Pivot" to find some techniques. Make sure that the data are grouped (partitioned) by the P column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Post by sylvan_rydes »

Hi All,

Thanks for all the replies. The only problem is that, there is no defined rules for the record. It depends on its serial no. We used store procedure and it works fine.

Thanks again.

Sylvan_rydes
sylvan rydes
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Even via datastage you can get this done but we need logic. I bet even the stored procedure executes some sort of logic. If you can get us that logic maybe someone can help you design you, or even walk you through the entire job.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sylvan_rydes
Participant
Posts: 47
Joined: Wed Apr 12, 2006 12:13 pm

Post by sylvan_rydes »

Hi All,

I m here to define the problem in detail. We have two address input. But one address to copied 3 times and the second one is copied 2 times in a target. All address belong to same person. Now for two address we have output table having 5 serial number for address. In next table we are again dividing these 5 in two but using the serial number now.

In store procedure we are generating same number in both the target tables but in datastage as we ave one job per target table so it is becoming a problem.

Thanks again for all your help.

Sylvan_rydes
sylvan rydes
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So, basically, the requirement is to sort by address and group by (a newly generated) serial number?

Sort the addresses with a Sort stage, then use a Transformer stage to detect changes and generate the serial number, incrementing when the value changes. Run in sequential mode or partition by hash on address so that all members of each group are on the same partition.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply