Page 1 of 1

Handling NULL indicator in DB2 Unload.

Posted: Sun Feb 18, 2018 11:39 am
by Binamra
While unloading a table im Using two columns value and multiplying it and assigning to receiving table table columns which is decimal(15,2) not null.. but in the unload file it is adding one more byte in the last for null indicator.

So one byte is moving right and while loading the table using that file it fails.

Can some one help how to avoid this one byte for null indicator in the unload file

[ Post made via Android ] Image

Re: Handling NULL indicator in DB2 Unload.

Posted: Sun Feb 18, 2018 9:05 pm
by Anuj Dhawan
Hi,

From memory, I recall that - once you unload the table, you should get a SYSPUNCH dataset. It should give you the 'load card' using in that. The unload dataset will have the data as per the 'definition' in SYSPUNCH dataset - with all this you should be good to go.

OR COALESCE should help you. Give that too a try.

Re: Handling NULL indicator in DB2 Unload.

Posted: Sat Mar 24, 2018 11:34 pm
by singhxmanish
One way could be to use DFSORT to eliminate the null after the field (in unload file) and structuring the data as per table to be loaded. Since the null is placed after the field I assume you used DSNTIAUL and null would be stored as ? Or X’6F’

Re: Handling NULL indicator in DB2 Unload.

Posted: Tue Mar 27, 2018 2:30 pm
by Binamra
singhxmanish wrote: Sat Mar 24, 2018 11:34 pmOne way could be to use DFSORT to eliminate the null after the field (in unload file) and structuring the data as per table to be loaded. Since the null is placed after the field I assume you used DSNTIAUL and null would be stored as ? Or X’6F’
Thanks but that will require one more step. I was looking for way which can be handled by DB2 itself.

Re: Handling NULL indicator in DB2 Unload.

Posted: Tue Mar 27, 2018 2:48 pm
by nicc
I was looking for way which can be handled by DB2 itself.
Why did you not say so in the first place?

Re: Handling NULL indicator in DB2 Unload.

Posted: Tue Mar 27, 2018 4:49 pm
by Binamra
I did not mean to say that it was required for me, I was just trying to make it clear that it would take one extra step.