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?

    Requires Free Membership to View

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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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: