converting variable length to fixed length 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
ajithaselvan
Participant
Posts: 75
Joined: Mon Jul 12, 2010 4:11 am
Location: Chennai

converting variable length to fixed length file

Post 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,
Ajitha S
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: converting variable length to fixed length file

Post 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. :?
-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 are "adding spaces". Each of those spaces takes up, well, space.
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