# Error 3198

**URL:** <https://techcommunity.softwareag.com/t/error-3198/95018>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [October 17, 2010, 5:25pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018 "2010-10-17T17:25:57Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 17, 2010, 5:25pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/1 "2010-10-17T17:25:57Z")

</div>

Hi,

We just got that error while 2 programs tries to store same key.  
Last year we have just wrote a code that should prevent that error code,  
but somehow it pops again (today for the first since writing).

```auto

repeat until #hold=true
  callnat 'x' #hold
end-repeat
rest #hold
```

x subprog

```auto

on error 3145
  reset #hold
  esacpe routine
end-error
reset #hold
read (1) x
  if false then
    update /* for hold record
  end-if
end-read
#hold := true
```

How did we got that error if all programs uses that subprog x ???

Thank You  
Hezi

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [October 17, 2010, 9:35pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/2 "2010-10-17T21:35:20Z")

</div>

the NAT3198 indicates that you are trying to store a duplicate value for a unique descriptor. The code you show only deals with putting records on hold. So how are you generating a value for your unique descriptor?

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 17, 2010, 9:44pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/3 "2010-10-17T21:44:53Z")

</div>

Hi,

The subprogram that use Read (1), read the last descriptor (Numerator), that was store in file, that why I read it with hold record, that no other will try to read it, before i perform ET.

Hezi

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 17, 2010, 9:56pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/4 "2010-10-17T21:56:35Z")

</div>

And than I add 1 for the new record

---

<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:** [October 18, 2010, 3:32am UTC](https://techcommunity.softwareag.com/t/error-3198/95018/5 "2010-10-18T03:32:40Z")

</div>

Hi Hezi,  
How are you?  
.  
As Douglas says, you reported a NAT3198 error (in the posting’s Subject line), yet you only give information about a NAT3145 error (in the posting’s Body text).  
.  
Q) So which error do you get:

- NAT3145 = record on Hold  
or
- NAT3198 = duplicate value for a unique descriptor ?

---

<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:** [October 18, 2010, 6:03am UTC](https://techcommunity.softwareag.com/t/error-3198/95018/6 "2010-10-18T06:03:53Z")

</div>

Hi Hezi,

Are you assuming you came back from the subprogram still holding the record, and therefore preventing anyone else executing subprogram x from holding the same record?

This is simply not true. You released that record when you ended the read loop. The ISN was released from the hold queue by the time you came back with the RC call to Adabas.

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 10:54am UTC](https://techcommunity.softwareag.com/t/error-3198/95018/7 "2010-10-18T10:54:46Z")

</div>

Hi,

> [@](#):
>
> So which error do you get:
> 
> - NAT3145 = record on Hold  
> or
> - NAT3198 = duplicate value for a unique descriptor ?

When the record is in hold I get 3145 but I catch it, with on error and escape the subprog ‘x’, to read it again (the endless loop).

> [@](#):
>
> Are you assuming you came back from the subprogram still holding the record, and therefore preventing anyone else executing subprogram x from holding the same record?

Yes, I though to prevent others to get the last unique descriptor, I need to hold the record until I release it with ET (both the dummy update from subprog ‘x’ and my new record).  
I thought I release the record in only 2 ways:1. perform ET, 2. the session is terminate.

The programs running in Online and Batch.

Hezi

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 11:07am UTC](https://techcommunity.softwareag.com/t/error-3198/95018/8 "2010-10-18T11:07:10Z")

</div>

Continue:

And somehow we got error 3198, while thinking we solved the issue.

Hezi

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [October 18, 2010, 6:02pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/9 "2010-10-18T18:02:22Z")

</div>

Although there is a Natural parameter to force an implicit ET at a module’s end, Brian, in most shops ETs are under the programmer’s control.

Hezi, what is the setting of the WH parameter? If ON, you will wait for the record to be released.

. User 1 Reads and holds record 100  
. User2 attempts to read 100, but must wait  
. User1 releases record 100 after creating record 101  
. User2 is permitted to read record 100 with hold  
. User 2 attempts to create record 101, but is issued 3198

Try setting WH=OFF to issue the 3145 immediately.

```auto
on error 3145
  reset #hold
  esacpe routine
end-error
SET GLOBALS WH=OFF /* <---
reset #hold
read (1) x
  if false then
    update /* for hold record
  end-if
end-read
#hold := true 
```

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 6:12pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/10 "2010-10-18T18:12:22Z")

</div>

Hi,

I forgot to mentioned, bt default we run with WH=OFF.

Hezi

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 6:19pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/11 "2010-10-18T18:19:25Z")

</div>

Hi,

I forgot to mentioned, bt default we run with WH=OFF.

Hezi

---

<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:** [October 18, 2010, 7:37pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/12 "2010-10-18T19:37:50Z")

</div>

You don’t increment your counter in this subprogram by your example. This implies you have to release it at some point because you are going to read or get the record with hold in another place to increment the counter. In the meantime, someone else can proceed with subprogram X and assume the same counter. Hence response 198.

You can solve this one of two ways. If you don’t care about sequence number gaps, you can get and increment the counter first. If you do care about gaps, wait until the last moment when the whole transaction is a sure thing and grab and increment the counter.

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 7:42pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/13 "2010-10-18T19:42:39Z")

</div>

Hi Brian,

I do Increment my counter after read the last one and holds it with update.  
I release both records with ET, for preventing other to try to store new record.

Hezi

---

<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:** [October 18, 2010, 7:51pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/14 "2010-10-18T19:51:22Z")

</div>

There is too much going on that is not evident with the information provided.

Can you re-create the NAT3198 in a test environment? If so, can you get the command logs (i.e., TEST DBLOG) so we can see what is held and what is released and the timing of any ET or BT that may be occurring?

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [October 18, 2010, 9:32pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/15 "2010-10-18T21:32:00Z")

</div>

Hezi - what is the “READ (1) x” actually doing to select the record? That is, is this a counter record that is held and updated to maintain the last value or is it something that selects the last record added in the database?

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [October 18, 2010, 9:44pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/16 "2010-10-18T21:44:57Z")

</div>

> [@](#):
>
> Can you re-create the NAT3198 in a test environment? If so, can you get the command logs (i.e., TEST DBLOG) so we can see what is held and what is released and the timing of any ET or BT that may be occurring?

Well. no. I have tried for 2 days to recreate it with no luck.

> [@](#):
>
> what is the “READ (1) x” actually doing to select the record? That is, is this a counter record that is held and updated to maintain the last value or is it something that selects the last record added in the database?

The Read (1) get the last numerator (unique descriptor) and hold it in update mode tp prevent others to get the same last numerator

Hezi

---

<div class="post-metadata">

**Author:** ![Hezi](https://avatars.discourse-cdn.com/v4/letter/h/a5b964/32.png) [@Hezi](https://techcommunity.softwareag.com/u/Hezi)\
**Post date:** [November 9, 2010, 2:42pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/17 "2010-11-09T14:42:35Z")

</div>

HI,

Regarding the issue, I dived into our Plog, and I notice that one of the 2 jobs tried to perform Store, but got Backout.  
It happened 2 times until the jod got abend.  
In what conditions we can get Backout?

Thanks  
Hezi

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [November 9, 2010, 6:13pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/18 "2010-11-09T18:13:59Z")

</div>

> [@Hezi](#):
>
> In what conditions we can get Backout?

Beside the Natural command, there are Adabas-Timeouts, deadlocks, etc. But then you should get an NAT3009…

---

<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, 2:59pm UTC](https://techcommunity.softwareag.com/t/error-3198/95018/19 "2021-04-02T14:59:14Z")

</div>


