Extra space between numeric columns in 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
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Extra space between numeric columns in fixed width file

Post by bollinenik »

Hi,
I am trying to create fixed width file with Numeric data type but one space is coming between for all columns.
Is there any way we can generate file width fixed format with numeric data type without space between columns.

*Note - Title made more descriptive - Content Editor*
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Post by bollinenik »

I tried giving field delimiter as none and removing that property but I can't fixed with file, still there is one space between fields.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... isn't the space a placeholder for the sign? Or is it literally between every column, even the string columns? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Post by bollinenik »

Thanks for your help.
space is not there for string columns it's there only for numeric columns.
yeah it's place holder. Is there any way we can read the same data/file with numeric data type only? not with char?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Check this post:

viewtopic.php?t=120334
-craig

"You can never have too many knives" -- Logan Nine Fingers
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

You could also set explicit formatting by editing the column meta-data.

1) Go to the column listing on the outputfile
2) Select the column you want custom formatting on
3) Hit Ctrl-E (control-E) to bring up the Edit Column Meta-Data pop-up

At this point you have two options to try, one that I think will work:
4a) Click on Extended (Unsigned) to turn off sign bit

-or- One that I know will work:
4b) Click on the Integer Type Property on the Parallel Tab
5b) Add the C_format property to the column with a format that either does not allow for a sign or puts the sign in front of the number.

In either case put a highly visible comment in the job because no-one will ever figure out that you've done this later!

If you select the alternate (b) route - you can check the internet for plenty of references on the formats that can be used - search for "sprintf c format" and you should find instructions.

Here's one example
http://www.cplusplus.com/reference/clib ... io/printf/

And of course - the third (and easiest) option - reduce the width of the columns by one (assuming your numbers still all fit) to allow for the space for the sign!
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
Post Reply