How to preserve the formatting (spaces) in varchar field

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
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

How to preserve the formatting (spaces) in varchar field

Post by UAUITSBI »

Hello,

In the source file there is a comment field which has below formatting:

Code: Select all

                          Reading       Math
African American:            60%          55%
Hispanic:                        60%          56% 
But while loading the data into DB2 below is the format that is loading into the table:

Code: Select all

                          Reading        Math
African American:         60%          55%
Hispanic:                           60%          56%
How can we handle this formatting issue in datastage ? Is there any environment variable which can resolve this ? I am not sure if APT_STRING_PADCHAR would take care of this as I used primarily for fixed width lengths.

Any help is appreciated !!

Thanks
Last edited by UAUITSBI on Tue Dec 16, 2014 11:14 am, edited 1 time in total.
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

Re: How to preserve the formatting (spaces) in varchar field

Post by UAUITSBI »

I think my post is not showing the formatting issue correctly though it did while typing. Is there a way I can attach a screenshot in the post ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You'll need to be more specific as to your exact issue as all of your formatting is removed by the forum software unless you use

Code: Select all

 tags.

ps. DataStage doesn't change spaces in a string unless you code it to do so.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: How to preserve the formatting (spaces) in varchar field

Post by chulett »

UAUITSBI wrote:I think my post is not showing the formatting issue correctly though it did while typing. Is there a way I can attach a screenshot in the post ?
Sure. Upload it to a file sharing site and then use the [Img] tags.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

Post by UAUITSBI »

Hi Chulett,

Thanks for the response. Yeah i have incorporated the code tag and was able to fix it a little. In the format that is there in the source 60% is aligned and so is the other column. But when the data is loaded into the table the format is not right.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I would wager that your spacing is just fine as it's not something that DataStage would change. Betting that it is whatever tool you are using to view the data after it has been inserted - it's probably using a proportional font which makes it look messed up when in fact it isn't. Try forcing it to use a fixed font instead.
-craig

"You can never have too many knives" -- Logan Nine Fingers
UAUITSBI
Premium Member
Premium Member
Posts: 117
Joined: Thu Aug 13, 2009 3:31 pm
Location: University of Arizona

Post by UAUITSBI »

Hi Chulett,

Thanks !!! I will check with the Database tool if there is anything in there that's causing the disproportion of the font.
Post Reply