Page 1 of 1

converting variable length to fixed length file

Posted: Wed May 08, 2013 6:10 am
by ajithaselvan
Hi,

I have a file with variable length of records.Maximum length is 2000 bytes.
I want to convert the file to fixed width. ie., I want to convert all the records to equal length of 2000 bytes by adding spaces.
I have shell script for the above conversion, however, the converted file occupies more momery in DS server. So I'm looking for better option that, whether can we do it n DS itself?
Could you please help me on this?

Regards,

Re: converting variable length to fixed length file

Posted: Wed May 08, 2013 7:12 am
by chulett
Read it in with varchar fields then write back out (to a new name) with CHAR fields. Make sure your PAD character is set to a space: 0x20.

I'm curious why you are doing this. Also curious what this might mean:
ajithaselvan wrote:I have shell script for the above conversion, however, the converted file occupies more momery in DS server.
If you mean the file is larger, well... of course it is. :?

Posted: Wed May 08, 2013 4:23 pm
by ray.wurlod
You are "adding spaces". Each of those spaces takes up, well, space.