Reading from sequential file

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
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Reading from sequential file

Post by Roopanwita »

HI,
We have input file as follows:

Code: Select all

XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION  
      
, we have to read the records from 5 column name (col1,col2,col3,col4,col5).
Can anybody suggest how to read the file.
WE have tried with fixed width column option , but all columns doesn't have same length,so it not working.
Also tried COlumn Importer stage ,but we are not getting desired results..
that for col2 , some part of col3 is getting attached to col2.

Thanks in Advance!
Last edited by Roopanwita on Thu Aug 14, 2008 1:23 am, edited 2 times in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Import the table definition for the Sequential file. Check the "fixed-width format" and specify the column widths in the field provided, or in the Columns grid (as Display Width) on the Define tab. Use this table definition in your job.

To retrofit the same, you need to alter the display width property of each field in the table definition in the Repository, or within your job design. The latter method is less than best practice.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Roopanwita
Participant
Posts: 125
Joined: Mon Sep 11, 2006 4:22 am
Location: India

Post by Roopanwita »

Thanks !
It is working fine now :lol:
bikan
Premium Member
Premium Member
Posts: 128
Joined: Thu Jun 08, 2006 5:27 am

Re: Reading from sequential file

Post by bikan »

Roopanwita wrote:HI,
We have input file as follows:

Code: Select all

XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION 
XXX XXXXXXX                            YYY YY YYYYY AAAAAA AAAA      WWW_WWW_WWW   WW     DESCRIPTION  
      
, we have to read the records from 5 column name (col1,col2,col3,col4,col5).
Can anybody suggest how to read the file.
WE have tried with fixed width column option , but all columns doesn't have same length,so it not working.
Also tried COlumn Importer stage ,but we are not getting desired results..
that for col2 , some part of col3 is getting attached to col2.

Thanks in Advance!
HI
one way is write the whole file into .csv file target and delete the unwanted columns.
Vasudev
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There was no mention of 'unwanted' columns, they just needed to know how to read a fixed-width file. And to write it in csv format, you'd still need to read it first. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply