Page 1 of 1

Padchar application not working properly

Posted: Mon May 28, 2007 9:47 am
by vivekreddy
I am applying an environment variable for padding the blank characters in a Char field. The variable is set to value "0x20", which corresponds to " " in ASCII.
However, when the data is written to the database, the blank characters are padded not with the " " character, but with the block character (which I cannot represent here, but I think you would understand).

I am using a DB2 v.8.1 database.

Could anyone suggest as to what could possibly the problem, and how I could solve it?

Posted: Mon May 28, 2007 9:57 am
by DSguru2B
What happens when you load a few records to a flat file or dataset? Do you see the block characters there too?

Posted: Mon May 28, 2007 10:00 am
by vivekreddy
No, I don't. Would that impact anything as such?

Posted: Mon May 28, 2007 11:24 am
by DSguru2B
No. It wont. That test was just to make sure that you were actually getting 'space' as a pad character.
What if you change your target sql type to varchar. Does that take care of the problem? The database will put the necessary spaces itself.

Posted: Mon May 28, 2007 11:41 am
by vivekreddy
Hi.

Sorry but changing the target SQL type to Varchar doesn't help. The database still puts the block character.
One more thing, the database insertion is highly inconsistent, as in some fields are affected by this, while some aren't.

Could you tell me why this may be so?

Posted: Mon May 28, 2007 12:08 pm
by DSguru2B
Ok. Let them be inserted with blocks. Do a select on this table and then load it to a flat file or send it to peek stage. Do you see those blocks in the file or log file? Do you have NLS enabled at the database and not datastage?