Loading to DB2 with PX

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
mfavero
Premium Member
Premium Member
Posts: 45
Joined: Thu Jan 16, 2003 1:20 pm
Location: Minneapolis

Loading to DB2 with PX

Post by mfavero »

I have written my first Parallel jobs and when I look at the data loaded to the DB2 table, the CHAR fields are padded with 'low values' (x'00') not spaces. I create a dataset in the first job and merge it with a seq file in the second and send the rejects (no match for the seq file) to a data set and just three columns to a small DB2 table.
I use the Transformer to send all columns to the the data set output link and split 2 columns and create a third column with a literal to the other output link which goes to the DB2 UDB API stage.
What am I doing to cause x'00' to pad the DB2 table? The dataset doesn't LOOK like it has any x'00's at the end.
Michael Favero

2852 Humboldt Ave So
Minneapolis, MN 55408
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You are leaving APT_STRING _PADCHAR environment variable set to its default value (0x00). If you want space padding, bring this into your job as a job parameter and change its value to a single space character or, if you must, 0x20.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

You can also specify the pad character in the column layout. When you write to DB2, make sure the field length in DataStage is the same as the target field in DB2. If DataStage's definition is shorter, then it won't matter if the pad char is set. DB2 will automatically fill it with x00.

Brad.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Okay, my bad. DB2 will pad as long as your char field in DataStage is padded. Sorry for the confusion. I did a test writing a char(5) to a char(10) in DB2 and it worked fine, all was space padded.

Brad.
mfavero
Premium Member
Premium Member
Posts: 45
Joined: Thu Jan 16, 2003 1:20 pm
Location: Minneapolis

Post by mfavero »

I find this all very strange when used to server of course, but I did determine that the Merge Stage caused the padding with x'00' on the key fields.

I managed to work around the problem by putting a transform stage with a Convert(from_Merge.column_name, char(00), ' '). This turned all the nulls to spaces.

I will try the APT_STRING _PADCHAR when I have time. You sure this isn't some kind of Thai dish or maybe far eastern musical instrument?
Michael Favero

2852 Humboldt Ave So
Minneapolis, MN 55408
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Top marks for the misleading etymology! :lol:
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