how to handle the below reuirement

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

how to handle the below reuirement

Post by snt_ds »

Hi I have a requirement like below. Can anyone help on this.

We have two columns like specified below.

Column A Column B
X1 10
X1 20
X2 22
X2 32
. .
. '
. .


We need output like specified below.

X1 10;20
X2 22;32
.
.
.


Could anypne please help me on this issue


Thanks in Advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Sort your data on Column A, then use stage variables and constraints in a transform stage along the following format:

Code: Select all

NewCol = IF(In.ColumnA=LastColumnA) THEN 1 ELSE 0
OutColumnA = IF NewCol=1 THEN LastColumnA ELSE ''
LastColumnA = In.ColumnA
OutList = IF NewCol=1 THEN ListString ELSE ''
ListString = IF NewCol=1 THEN '' ELSE ListString:';':In.ColumnB
Constraint is "NewCol = 1", the 2 output columns are derived from "OutColumnA" and "OutList".
Post Reply