Q

Getting data to unload

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?
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.

This was first published in October 2004

Dig deeper on IBM DB2 management

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchBusinessAnalytics

SearchAWS

SearchContentManagement

SearchOracle

SearchSAP

SearchSOA

SearchSQLServer

Close