Problem solve Get help with specific problems with your technologies, process and projects.

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:


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 on IBM DB2 management

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.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.