Page 1 of 1

Extra space between numeric columns in fixed width file

Posted: Thu May 14, 2009 4:35 pm
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*

Posted: Thu May 14, 2009 4:38 pm
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.

Posted: Thu May 14, 2009 4:39 pm
by chulett
Hmmm... isn't the space a placeholder for the sign? Or is it literally between every column, even the string columns? :?

Posted: Thu May 14, 2009 5:38 pm
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?

Posted: Thu May 14, 2009 7:59 pm
by chulett
Check this post:

viewtopic.php?t=120334

Posted: Thu May 14, 2009 8:43 pm
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!