How can I genarate multiple rows from a single row

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
deva
Participant
Posts: 104
Joined: Fri Dec 29, 2006 1:54 pm

How can I genarate multiple rows from a single row

Post by deva »

Hi All,
I have one requirement. I have 3 cols one is cust id,eff.date,no.of.installments.
My question is if custid is 1000 and eff.date is feb/12/2002, and number of installments are 4.
I am looking for the output with 4 rows.
1000 feb/12/2002 4
1000 feb/12/2002 4
1000 feb/12/2002 4
1000 feb/12/2002 4

we are using 7.1/ 7.5 datastage server.

Thanks in advance
swades
Premium Member
Premium Member
Posts: 323
Joined: Mon Dec 04, 2006 11:52 pm

Post by swades »

Can you provide more details.

You can do:-
Read installments as source ,and do ODBC look up against same table,using installments as key.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How is this different from your other post? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
sreeni
Participant
Posts: 17
Joined: Thu Jun 03, 2004 5:08 am

Post by sreeni »

Try to use Job activity stage to call your job in Start loop and End loop activity stages in the Job sequencer. Use Start value = 1 , End Value =4.
Then same input record gets inserted into output stage four times.
sreeni
Participant
Posts: 17
Joined: Thu Jun 03, 2004 5:08 am

Post by sreeni »

Try to use Job activity stage to call your job in Start loop and End loop activity stages in the Job sequencer. Use Start value = 1 , End Value =4.
Then same input record gets inserted into output stage four times.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Write a small routine that takes in the entire record of three columns as a single argument, get the "Installment" count and run a loop equal to the installment count. Within the loop, concatenate the entire record with each other delimited with a line feed. Since you are on windows, it will be Char(013):Char(010).
This way you will feed in one row and get x rows where x is your installment count.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply