Page 1 of 1

Loading data into fixed width flat file using seq file stage

Posted: Sun May 26, 2013 8:57 am
by ramakrishna459
Hi all

I need to load the data into flat file as fixed width format,source is a sql server and am using runtime column propagation .But few of the columns in the target are Integer and timestamp.So if i use char data type for integer how much length should i give and for timestamp columns when i use char data type the job is getting aborted due to conversion problem.

So to generate the fixed width file please suggest me the approach.

Thank you

Posted: Sun May 26, 2013 9:01 am
by chulett
So just to be clear, you want to know how to generate a fixed-width file in an RCP enabled job, yes?

Posted: Sun May 26, 2013 9:40 am
by ramakrishna459
yes craig.....

For integers and timsestamp columns what datatype can be used.....

Posted: Sun May 26, 2013 9:54 am
by chulett
What happens when you stick with the original datatypes?

Posted: Sun May 26, 2013 11:16 am
by ramakrishna459
The problem is the integer column data is not all of same length.as am using RCP i cant transform any columns.and for timestamp columns there is no problem if there is null am populating space(26)

Posted: Sun May 26, 2013 2:06 pm
by ray.wurlod
Schema file?

Posted: Sun May 26, 2013 11:58 pm
by ramakrishna459
Yes am using schema file.The problem is with integer and timestamp columns for that how we can use to get fixed width format.

Posted: Mon May 27, 2013 8:48 am
by ramakrishna459
i have in the source Int(4).If i want to convert into char what length should i give.

Posted: Mon May 27, 2013 8:57 am
by chulett
It's an integer, the (4) just means it is stored in 4 bytes. Look up the maximum size of an integer and account for that.

Posted: Mon May 27, 2013 9:05 am
by ramakrishna459
craig

For the integer column having length of four .I queried in the database it has max length of data stored is six.so should i go for the char(6) or any logical conversion is required between integer(4) to determine the character length.

Posted: Mon May 27, 2013 9:34 am
by chulett
Forget the 4, it plays no role here. An integer can store a value up to 2147483647. However, if you are confident your value will never go over 999999 then use 6 for the length otherwise best to use 10 (or 11 if signed).