Fixed Width 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
ajith
Participant
Posts: 86
Joined: Thu Nov 10, 2005 11:10 pm

Fixed Width File

Post by ajith »

Is there a way in which I can populate the Fixed width file with Varchar and Integer fields padding them with space beyond their length?

It seems stupid, but if there is a way, I would be able to save a lot of stages.

Thanks in advance,
Ajith
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

yes. define the target file format correctly for fixed width.
possibly you can define all the field of type char.
talsimad
Participant
Posts: 8
Joined: Mon Nov 28, 2005 4:56 pm

Fixed Width File

Post by talsimad »

you can use a transformer to pad your varchar or integer columns with spaces:
you have to use the function PadString it's very simple to use, for exemple if your have a varchar(10) column C and you got "abc" in this column if you want to pad C with 7 spaces:
PadString(C,' ',10-Len(C)) --> rignt padding
or
PadString('',' ',10-Len(C)) --> left padding.

good luck :wink:
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Simplest way would be to define the target file as fixed width and specify the fields as char. That should take care of it.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ajith
Participant
Posts: 86
Joined: Thu Nov 10, 2005 11:10 pm

Post by ajith »

Thanks for all the replies.

I am currently defining every column as char and converting each and every column to char, I was just wondering, if i can avoid these conversions that would be very helpful.

There is no way to write a Varchar directly without using a modify or transformer to a fixed width file?. I was just trying to minimize the use of those stages (modify and transformer).

Thanks in advance,
Ajith
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make it Char and it will be padded automatically with the character defined in APT_STRING_PADCHAR.
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