# Is there any duplicate key or duplicate record error in Adabas?

**URL:** <https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-on-Mainframes, Adabas-Basics-on-Mainframes\
**Created:** [March 20, 2012, 2:43am UTC](https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923 "2012-03-20T02:43:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shashank\_Gite1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/shashank_gite1/32/351_2.png) [@Shashank\_Gite1](https://techcommunity.softwareag.com/u/Shashank_Gite1)\
**Post date:** [March 20, 2012, 2:43am UTC](https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923/1 "2012-03-20T02:43:13Z")

</div>

I am writing a Natural program for inserting and storing many records into an Adabas file. There are chances of duplicates records getting inserted in same file. Is there any duplicate key or duplicate record error in Adabas, which may cause Abend? Should I handle such error as we do in DB2?

Thanks  
Shan

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [March 20, 2012, 3:23am UTC](https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923/2 "2012-03-20T03:23:52Z")

</div>

It depends on whether your DBA has established a unique attribute on a descriptor value. If not, you can have an entire file full of duplicate records. If so, you can get an Adabas response code 198: [http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada823mfr/adamf/messages/nucresp.htm#Response\_198](http://techcommunity.softwareag.com/ecosystem/documentation/adabas/ada823mfr/adamf/messages/nucresp.htm#Response_198)

With Natural, it is typically up to the programmer to have some knowledge of any descriptors that should be unique and to perform the necessary check for the existence of a “primary key” value before storing a record. In Adabas, there is no concept of primary key even though it’s possible to use the unique attribute. My experience is that it is seldom used.

The remedy for this is to not allow a programmer who would do such a thing near a keyboard.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [March 21, 2012, 2:57pm UTC](https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923/3 "2012-03-21T14:57:02Z")

</div>

The Adabas rsp 198 will be seen as an error 3198 in Natural, btw.

As a sidenote:

this is one of the few cases where the response code is different on the  
mainframe and LUW, the equivalent on LUW is a rsp 98.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:01pm UTC](https://techcommunity.softwareag.com/t/is-there-any-duplicate-key-or-duplicate-record-error-in-adabas/99923/4 "2021-04-02T15:01:40Z")

</div>


