Generate 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
bjcripe
Participant
Posts: 9
Joined: Fri Apr 30, 2004 11:35 am

Generate Multiple Rows from a single row

Post by bjcripe »

Hi,

I am using Server and trying to generate a job to read in a record, divide one field into multiple rows. Example --
Record in informix source
Record 1
Field 1: A
Field 2: XYZ
Records needed in informix target
Record 1
Field 1:A
Field 2:X
Record 2
Field 1:A
Field 2:Y
Record 3
Field 1:A
Field 2:Z

both fields are dynamic so I will have to loop through until there is no more data in field Field 2 before moving on to the next record.

Thanks in advance --- Brian
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

hi

if you can bring your input into fixed fields then you can use Pivot stage. Otherwise you need to code this in basic.

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

Post by ray.wurlod »

Are there always exactly three characters in Field002? If so, you can use something like this.

Code: Select all

source ---->  Transformer  ----->  SeqFile  ----->  Target
The Transformer stage writes a single column to the SeqFile stage, of the form

Code: Select all

Key:",":Field001:",":Field002[1,1]:NL:Key:",":Field001:",":Field002[2,1]:NL:Key:",":Field001:",":Field002[3,1]
NL is the appropriate new-line character(s) for your operating system.
Output from the SeqFile stage treats it as a regular comma-delimited file.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

Is Field 2 a multi-valued field, like from a Universe database? The Universe stage allows you to "Normalize" on a multi-valued field. This method allows you to handle a varying number of values in Field 2 (which is what I think you mean when you say 'dynamic').

Hope this helps,
John
Post Reply