Difficult to reading the source file with multiple childs

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
rajikatam
Participant
Posts: 4
Joined: Thu Nov 16, 2006 2:43 am
Location: banglore

Difficult to reading the source file with multiple childs

Post by rajikatam »

Hi,
I am getting SRCFile as 7 rows with child records and like this

r1 4 columns, 01,xxx,yyy,1
r2 6 columns, 02,aaa,bbb,ccc,ddd,2(count for child)
r3 5 columns, 03,nnn,mmm,ooo,1
r3 child 5 cols 03,nnn,mmm,xyz,1
r4 have 4 cols 04, , , ,2(count)
r5 have 3 cols 05, ,0
r5 child 05, ,0

Here child records may or may not repeat in the next set of record(Here r1 to r5 is one set of record)

I need to read the Data file as
Target file structure like this r1|r2|r3|r4
r1|r2|r3(2nd chilld record come here)|r4
r1|r2| |r4|r5
r1|r2| |r4|r5(child record come here}

child record will be depend ing on the r2,r4 record count column.

but I am having problem to capture the Child record of r3,r5 in the file.

as I am Using the Stage variables its overwriting the r3, r5 child records

Pls suggest any other way to capture all the records(with child)

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

Post by ray.wurlod »

Welcome aboard.

Three mechanisms spring to mind.

One is to use stage variables as accumulators, and detect change of record type.

The second is to pre-process the file (since you have counts of the number of child records) to flatten the multi-row "record" into a single record.

The other is to use a Complex Flat File stage. However, since these do not support multiple OCCURS DEPENDING ON clauses, you will have problems getting this approach to work in versions earlier than 8.0.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply