Rows to 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
shaonli
Participant
Posts: 80
Joined: Tue Nov 28, 2006 6:52 am

Rows to column

Post by shaonli »

My i/p is
Loc name address
100 a1 abc
100 a2 abcd
200 b1 abcds
200 c1 abcdsa
200 a1 abc
300 a1 abc

O/p
Loc name1 name2 name3 address1 address2 address3
100 a1 a2 null abc abcd null
200 b1 c1 a1 abcds abcdsa abc
300 a1 null null abc null null

Please suggest which stage to use for converting rows into columns
siva7143
Participant
Posts: 35
Joined: Wed Aug 09, 2006 12:20 am

Re: Rows to column

Post by siva7143 »

For the above scenario Pivot stage can be used to convert the rows into columns.Use the Derivation field in the output link column grid to specify the pivots.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Pivot stage goes from rows to columns (horizontal pivot), not columns to rows (vertical pivot). Search the forum for "vertical pivot" to learn various techniques.

It has been suggested (at IOD 2007) that vertical pivot will be possible in the Pivot stage in version 8.1 (later this year).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

You can use the combined record stage or you have to write a logic in the transformer to convert rows into columns.
Post Reply