I have a DB2 column defined as varchar(300) that is used to store dates in packed decimal form. The date is stored as an array of 5 bytes each.
If there are 10 dates, then the length of the column is 50 bytes. When I try to unload this column using DSNTIAUL, the first 50 bytes are unloaded as is but the rest of the 250 bytes is padded with low-zeroes (x'00').
Is there any option to change the pad character to spaces when unloading the data?
When you register, you'll begin receiving targeted emails from my team of award-winning writers. Our goal is to keep you informed on the hottest data and information management trends today.
Hannah Smalltree, Editorial Director
Since you are using DSNTIAUL, you cannot use the VARCHAR STRIP TRAILING specification that can be set using the UNLOAD utility. However, you should be able to use DSNTIAUL to unload data from a view. To solve your particular problem, create a view of the table that selects all of the columns, except for the VARCHAR(300) column. Instead, use the STRIP function on that column.
For example, if the VARCHAR(300) column is named VCOL, specify it as follows in the SELECT of the view:
STRIP(VCOL,TRAILING)
This will cause trailing blanks to be stripped off. Then, use DSNTIAUL to unload from the view instead of the table, and that should do the trick.
Good luck!
Editor's note: Do you agree with this expert's response? If you have more to share, post it in one of our
.VO7aaqqaAFk.0@/search390>discussion forums.
Dig Deeper
-
People who read this also read...
This was first published in October 2004