Solved

Load from cursor rejecting rows of data. How can I determine which rows are rejected?

Posted on 2010-09-23
6
2,025 Views
Last Modified: 2013-11-17
Question: Hello all,
I am loading from cursor a particular table which is range partitioned from the mainframe DB2 z/os machine to DB2 on a AIX box. Ok, now I went on to load the table and got the following statistics:
Number of rows read         = 10149185
Number of rows skipped      = 0
Number of rows loaded       = 10148630
Number of rows rejected     = 555
Number of rows deleted         = 0
Number of rows committed    = 10149185

Is there a way to determine the rows being rejected? Is it possible to write rejected rows to another file?  I have tried to use the "modified by dumpfile = filename" option of the Load utility such as thi "db2 "LOAD FROM LOAD_CUR11 OF CURSOR messages load.msg modified by dumpfile = rca_load_rejects.txt REPLACE INTO PADBA001.PADTB_AR_TRANSACTION nonrecoverable" but got error "SQL0104N  An unexpected token "modified" was found following "<identifier>". Expected tokens may include:  "REMOTE".  SQLSTATE=42601"

Then I reposition the dumpfile option like this "db2 "LOAD FROM LOAD_CUR11 OF CURSOR modified by dumpfile = rca_load_rejects.txt messages paw_ar_transaction.msg REPLACE INTO PADBA001.PADTB_AR_TRANSACTION nonrecoverable" and got a different error:

SQL3016N  An unexpected keyword "dumpfile" was found in the filetmod parameter
for the filetype.

Does this mean I can't use modified by dumpfile in this context?  Anyway I can do what I need done which is to trap rejected rows?

Any help will be highly appreciated.
okonita1
0
Comment
Question by:okonita1
  • 3
  • 3
6 Comments
 
LVL 45

Expert Comment

by:Kdo
ID: 33750290
Hi okonita,

On the LOAD command, use the MESSAGES and/or FOR EXCEPTION clauses.


The MESSAGES clause names the file that DB2 will us to write the error messages.

The FOR EXCEPTION  clause names a table where data will be load that violates unique index or primary key rules.


You can also specify the DUMPFILE clause, and all rejected rows will be written to this file.


Kent
0
 

Author Comment

by:okonita1
ID: 33751149
Kdo,

I just found out that the dumpfile is not supported with load from cursor. Here's the IBM link for report:
http://www-01.ibm.com/support/docview.wss?uid=swg21259962

However I have not tested the For EXCEPTION clause so I'm not sure if is supported for a LOAD from CURSOR.

0
 
LVL 45

Expert Comment

by:Kdo
ID: 33752365

That's kind of evil of IBM to not support DUMPFILE, huh?  I can kind of understand why, but still....

FOR EXCEPTION is documented as working, and I have used it.


Kent
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:okonita1
ID: 33752481

Okay Kdo,I read the documentation and it came sounds to me like it is used mainly when your are loading from an input file not from cursor virtual file such as Load from cursor_Name replace into table_name.

I will try first thing this morning. Do you have an example of how you used it?
0
 
LVL 45

Accepted Solution

by:
Kdo earned 500 total points
ID: 33753042

I don't have a good example (in my current duties don't I don't see bad data so I don't have to handle it).

But, IBM does have documentation.  :)

Here is a description of load exception tables.  Nothing magical here, just a pretty good description.

  http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/c0004596.htm


Here are the rules for creating exception tables, probably in more detail than you want to read:

 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001111.htm




Good Luck,
Kent
0
 

Author Closing Comment

by:okonita1
ID: 33823870
Well, while none of the answers provided a complete and working example for using a dumpfile, kdo has been very helpful in the past so I am awarding the points to him, anyway. to make the dumpfile work, it seems that you need to enclose the syntax in double-quotes like this: dumpfile="/tmp/dump_file_name"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now