Creating 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
gayathrisivakumar
Premium Member
Premium Member
Posts: 60
Joined: Thu Dec 17, 2009 1:36 am

Creating fixed width file

Post by gayathrisivakumar »

Hi All,

I am trying to create a fixed width file, where all the incoming fields have datatype char and Nullable.

I haven't mentioned any format properties, except Null field value as '', in sequential file stage. The problem now is, a space is getting added after each field, in the output file. How I can remove that?

I tried to give the format as Fixed width, but I got an error saying 'Error when checking operator: "record_length=fixed" (no length given) and record field format is variable-length. The first variable-length field is 'Field_name'.

Can someone please help?

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First off, you cannot have any nullable fields in a fixed-width file unless you also make sure the Null Field Value is all spaces. Also, I seem to recall a property where you specify the number of bytes between columns, you may need to set that to zero. Also think you need to make sure you set the Display Size (?) properly as that value is what it uses to determine the fixed-width size - I'm assuming it isn't set and is why you are seeing the 'no length given' message.

But it has been a while. :wink:

Oh, also make sure your APT_STRING_PADCHAR variable is set to 0x20.
-craig

"You can never have too many knives" -- Logan Nine Fingers
gayathrisivakumar
Premium Member
Premium Member
Posts: 60
Joined: Thu Dec 17, 2009 1:36 am

Post by gayathrisivakumar »

Thanks Craig.

Mine is not a fixed length file. But its a fixed width column file. If any value is null, then nothing should be populated.

Your comments made me check the APT_STRING_PADCHAR variable and I have changed it to 0x0 at job level (it was 0x20). Now the output file is getting populated correctly.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

use Char instead of varchar and use same number of spaces as the field length to fill null (null field value) and explicitly define field delimiter as none.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

gayathrisivakumar wrote:Mine is not a fixed length file. But its a fixed width column file. If any value is null, then nothing should be populated.
Honestly never heard of such a thing. A column can't be any kind of "fixed" in width if the width changes when the value is null. :?

But if it is working as you need it to work, then yay.
-craig

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