DB2 Enterprise Stage

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
dsuser
Participant
Posts: 12
Joined: Mon Sep 15, 2003 9:11 pm

DB2 Enterprise Stage

Post by dsuser »

We did load a table in DB2 using a DB2 Enterprise Stage fetching data from a Sybase source. There were a couple of columns with the char datatype.
When the data gets loaded and I try to retrieve the data from the table I see all the char columns have been padded with spaces. And I'm not able to do a rtrim on this. Even after a rtrim it still gives the actual length of the column and not the length of the value in that column.
I also tried this(DB2 Enterprise) with a varchar type and I see the same behaviour.

Where as I can perform an rtrim on a manually entered row and it works fine.
The same works fine when an DB2 API stage is used.

Has anybody come across this before. And is there a specific way in which DB2 Enterprise stage behaves that I'm missing on.

Thanks,
dsuser
RobertScarbrough
Participant
Posts: 24
Joined: Fri Oct 01, 2004 1:43 pm
Location: USA

Re: DB2 Enterprise Stage

Post by RobertScarbrough »

I would check to see if they are really spaces. I ran into something similiar and it turned out it was because it was padded with nulls and not spaces. Using a SQL select statement on the column probably isn't going to be too helpful to determine that. Try changing the $APT_STRING_PADCHAR to be a space with no quotes and see if that helps. If not inspect one of the columns before you try and load it to the table to make sure that you have a space instead of a null.

Good luck.

-rls
dsuser
Participant
Posts: 12
Joined: Mon Sep 15, 2003 9:11 pm

Post by dsuser »

I tried to replace a space with an empty string and it let me replace and when I did a rtrim and then found the length it gave me the right length of the value in the column which makes me guess it should be a space. replace(colname, ' ','')

Thanks,
dsuser
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Different databases handle the CHAR datatypes differently. All (necessarily) store the trailing space characters. Some mandate the trailing spaces in queries in result sets, others do not. I think you have encountered this, and have already deduced how to work around it.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply