Natural/DB2

Natural/Db2

My natural program is trying to update a db2 file and failing with SQL error code = -803 program tries to insert duplicate record/key inside database. I want to do error handling in my program to avoid this failure and write the error record into another dataset. Please suggest me an idea if there is any way.