Solved

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

Posted on 2010-09-23
6
1,994 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

708 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

11 Experts available now in Live!

Get 1:1 Help Now