Extract repeating structure from sequential file

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
trenord
Participant
Posts: 2
Joined: Tue Jul 25, 2006 4:52 pm
Location: Geelong

Extract repeating structure from sequential file

Post by trenord »

Hi,

I am fairly new to DataStage and I was wondering if some could please help me out with this problem. I have a sequential file for which the fields within it are of fixed width (no separators). Within an individual record there are structures that repeat themselves multiple times and I wish to normalise these and put them in to their own table. The illustration below shows what I am trying to achieve.I have used the names Field1, Field2, Field3 to indicate the repeating structure. Also, for the purposes of the illustration I have used a comma to delimite the fields

INPUT DATA
----------

Key, Field1, Field2, Field3, Field1, Field2, Field3, Age, DOB .....
10000, X, Y, Z, A, B, C, 24, 19/06/1982 .....

I want the above data to be split in to the following two tables.....

OUTPUT_TABLE_1
--------------

Key, Field1, Field2, Field3
10000, X, Y, Z
10000, A, B, C

OUTPUT_TABLE_2
--------------
Key, Age, DOB .....
10000, 24, 19/06/1982 .....

In the file I am working with, some of these structures repeat themselves 35 times so I was looking for something a little more efficient then having 35 separate output links. Any ideas would be appreciated,

Regards
- Mark
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. :D

What you are seeking to do is called a "horizontal pivot" and is performed by the Pivot stage. Read its manual (pivot.pdf) for a good description of how to use it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
trenord
Participant
Posts: 2
Joined: Tue Jul 25, 2006 4:52 pm
Location: Geelong

Post by trenord »

Thanks Ray, I will have a good read through the doco.

Cheers
- Mark
Post Reply