My requirement is to inert the rows into a DB2 table from a sequential file which has records in millions.

For that I'm using Multi Row Insert feature with NOT ATOMIC CONTINUE ON SQLEXCEPTION option. Now I want to write all the records that failed to insert in an Error file.

For ex: If I'm doing a multi row insert for 10 rows and SQLERRD(3) of SQLCA returns 7, this means 3 records failed to insert.
How can I identify which 3 records are failed to insert and the error(SQLCODE) associated with them?

Thanks. Could you please provide any link or document where I can find more about GET DIAGNOSTICS feature. What are the variables and the syntax which can help me to identify the information that I need. I tried the manual, but

Thanks Gnanas. The link you provided looks useful. I will work on it monday now.

Quote:

If you have a array of 10 and then you are doing this in a sequential mode so certainly the 8th occurance of the same array has a probably duplicate data or a bad data.

@Rohit: I'm doing multi insert as below (WS-NUM-ROWS=10).
First I'm reading the first 10 records from file and populating the WS-CUSTOMER table and then performing an insert. If successful, read the next 10 record else find out which one failed and write them into an error file.

So in your process you can check the SQLCODE <> 0 after MASS/MULTI INSERT then write that 8th one to the error file and then perform another para in a loop to simply try inserting rest of the 2 records( 9 and 10) and once it does again loan next 10 records to the array and perform your original MASS/MULTI INSERT.

I didn't understand this part at all. Could you please elaborate further.

Why, though, would a row-id need to be able to go to 9,999,999,999,999,999,999,999,999,999,999?

That's ten (US) billion-billion-biliion-billion-billion-billion (I think, but it hardly matters), give or take one. Is that really reasonable? ARITH(EXTEND) has performance penalties if using numeric FUNCTIONs, as does the use of any packed-decimal with more than (15 I think it is) digits. 15 digits can give you a billion-billion-billion, which is often enough.