Reading A File with variable record length

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
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Reading A File with variable record length

Post by bapajju »

Hello,

We are trying to read a file that has records with variable lengths.For example, one record has 5 Fields, the second record has 7 fields, the third record has 4 fields.

What would be the simplest way to read such a file. Please let me know.

thanks
Amitav
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

When reading a sequential file you can specify attributes for what to do when a column is missing or null. I would suggest you define the maximum number of columns but for those that might be missing in certain rows declare them to be empty when they aren't defined in the source.
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Thanks ArndW. Thanks for the quick response. I will try it out.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You also need to analyze the reason and business logic for this variation.
chitra
Participant
Posts: 4
Joined: Thu Jan 22, 2004 1:15 am

Post by chitra »

If you have a preprocessing script like Shell/perl script, You can also convert the file as a delimited file and read it from the sequential file stage.
Post Reply