MULTIPLE ROWS TO SINGLE ROW

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
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

MULTIPLE ROWS TO SINGLE ROW

Post by ajithaselvan »

Hi,
Kindly help me to solve this in parallel job.

Input:
REC_TYPE,REC_COUNT, REC_SUM
C,3,1000
D,5,1500

Output:
REC_TYPE,C_REC_COUNT,C_REC_SUM,D_REC_COUNT,D_REC_SUM
T, 3, 1000, 5,1500


Thanks & Regards
Ajitha S
jweir
Participant
Posts: 134
Joined: Wed Aug 04, 2010 12:31 pm

Post by jweir »

Use a colon to concatenate the input links.
Jweir

--- If strength were all, tiger would not fear scorpion.
sajal.jain
Participant
Posts: 11
Joined: Sat Mar 13, 2010 12:00 am

Re: MULTIPLE ROWS TO SINGLE ROW

Post by sajal.jain »

How do you arrive at 'T' in output & and what is criteria to merge... Are sets of 2 rows to be merged into one ?
Major GungHo
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

Re: MULTIPLE ROWS TO SINGLE ROW

Post by ajithaselvan »

In the output, REC_TYPE 'T' is the hardcoded value. Yes.2 input rows has to be merged into single row.



Thanks & Regards
Ajitha S
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

Post by ajithaselvan »

Thanks jweir.
Can you please more specific?


Thanks & Regards
Ajitha S
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

Maintain first record at Stage Variable by using @Inrownum.

Sv1--> If @Inrownum=1 Then inputfield1 Else Sv1
Sv2--> If @Inrownum=1 Then inputfield2 Else Sv2

Write the fields to target when @inrownum=2 by deriving all the attributes.
Cheers
Ravi K
Post Reply