Source File separated with two delimiters

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
Vignesh Shanmugam
Participant
Posts: 10
Joined: Mon Feb 22, 2010 1:58 am
Location: Chennai

Source File separated with two delimiters

Post by Vignesh Shanmugam »

Hi all,

I have requirement to extract records from a source file separated with two delimiters. Like shown below.

Source File:-
___________

"CLAIM_NO"~"DOL"~"INJURY1"#"INJURY2"#"INJURY3"~"POLICY_NO"
"10000001"~"2010-01-01"~"HEAD"#"NECK"#"LEG"~"12345"
"20000002"~"2008-01-01"~"FINGER"#"ABDOMEN"#"CHEST"~"11111"
"30000003"~"2009-01-01"~"ANKLE"#"NECK"#"LEG"~"22222"

My out put File should be off the following format

OutPut File:-
__________


"CLAIM_NO"~"DOL"~"INJURY"~"POLICY_NO"
"10000001"~"2010-01-01"~"HEAD"~"12345"
"10000001"~"2010-01-01"~"NECK"~"12345"
"10000001"~"2010-01-01"~"LEG"~"12345"
"20000002"~"2008-01-01"~"FINGER""~"11111"
"20000002"~"2008-01-01"~"ABDOMEN"~"11111"
"20000002"~"2008-01-01"~"CHEST"~"11111"
"30000003"~"2009-01-01"~"ANKLE"~"22222"
"30000003"~"2009-01-01"~"NECK"~"22222"
"30000003"~"2009-01-01"~"LEG"~"22222"

There might be "n" number of Injuries separated by "#".Each and every Injury separated with "#" should go to th next line.

Any Help would be Highly Appreciated

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

Post by ray.wurlod »

This is best achieved using a server job and the dynamic array handling abilities of the Hashed File or UniVerse stage types.

If you must use a parallel job, then it looks like a job for a Column Import stage to parse the nested information, and a Pivot stage to generate the multiple rows.
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