Flattening a multi record type text 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
hsahay
Premium Member
Premium Member
Posts: 175
Joined: Wed Mar 21, 2007 9:35 am

Flattening a multi record type text file

Post by hsahay »

Hi

I need to flatten a mainframe like text file. There are 3 record types:
Header (1st byte is an 'A')
Segment (1st byte is a '$')
Detail (1st byte is numeric)

Input
Axxxxxxx
$yyyyyyy
01detaaa
02detbbb
03detccc
Azzzzzzz
$jjjjjjj
01detddd

Desired Output
Axxxxxxx$yyyyyyy01detaaa
Axxxxxxx$yyyyyyy02detbbb
Axxxxxxx$yyyyyyy03detccc
Azzzzzzz$jjjjjjj01detddd

Any Suggestions?

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

Post by ray.wurlod »

First byte or first character?

Either way, I'd read this as a single VarChar field and do the parsing and flattening in a Transformer stage. Use stage variables to preserve, and detect changes in, the header and segment records.
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