How to read Continous Records, No delimeter

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
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

How to read Continous Records, No delimeter

Post by vinodn »

Hi All,

I got a file with continous records written in a single line and there is no space or any other delimeter, but I need to read the data and split the records according to the Length and then need to populate each and every column.

Format of the File is as follows

HEADERRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDDETAILRECORDTRAILERRECORD


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

Post by ray.wurlod »

All you need is no Record Delimiter property, and Record Length = Fixed on the Format tab (and, by implication, First Line is Column Names = False on the Properties tab).

When importing the table definition for the Sequential File, you specify that it is fixed width format, and the width of each column in the record. Once the table definition has been imported, click the Sync Parallel button.

Those things having been done, the Sequential File stage will be able to read your 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.
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

Post by vinodn »

Hi Ray,

There is one more problem, HEADERRECORD or TRAILERRECORD Length varies, it might be of 40 or 45, etc., then how to separate this two records
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That doesn't make any sense. You can't have a fixed-width file with no record delimiters and then say some records vary in length. :?

Unless there is a leading field in each record denoting that particular record's length?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You said the file is fixed record width. Now you say it isn't. The solution is different - you will need to pre-process the file, reading it a block of bytes (or even a character) at a time, to produce a line-terminated file in the second case. If you're good with sed or awk you could use those; you could also use a Routine activity in a job sequence.
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