Page 1 of 1

what is '0x0', what significance it has with padchar

Posted: Wed Jan 14, 2009 3:24 am
by zulfi123786
In my project the default value for APT_STRING_PADCHAR is 0x0.
i am mapping 'HUB' to a field char(5), now when i view the data at the target i dont see any characters padded to this value. can anyone explain what is this '0x0' and what happens when this is padded.

In between i am using a transformer where i am checking if the value is 'HUB', unfortunately the condition is failing. i think the reason might be that 'HUB' is padded with '0x0'??? now if i need to check for this value in the transformer how am i supposed to do so?
should i check with 'HUB0X00X0'
please suggest!!!

Posted: Wed Jan 14, 2009 4:24 am
by ray.wurlod

Code: Select all

"HUB" : Char(0) : Char(0) 
would be one way.

0x00 is another way to represent the single-byte character whose encoded value is 0. In ASCII this character is called NUL (not the same as NULL in SQL). This character is recognized in the C language as terminating a string, so it is a useful character with which to pad fixed length strings.

Posted: Wed Jan 14, 2009 6:02 am
by eostic
I had a similar problem, not in a Transformer, but in a Web Service because the binary zeros (see Ray's description above) were aborting the construction of the SOAP envelope. Default 00 for null padding is obnoxious (imho). Set the variable to a single blank (no quotes just = followed bya space). Then it will pad with spaces. May not solve your problem, but will at least make it more sane to comprehend.

Ernie