# NAT3021: An invalid CID value was detected.

**URL:** <https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Adabas-on-Mainframes, Adabas-Basics-on-Mainframes\
**Created:** [February 6, 2018, 8:17am UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009 "2018-02-06T08:17:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maitree\_Priyadarsini1](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Maitree\_Priyadarsini1](https://techcommunity.softwareag.com/u/Maitree_Priyadarsini1)\
**Post date:** [February 6, 2018, 8:17am UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/1 "2018-02-06T08:17:53Z")

</div>

Hi All,

We have a task which Reads a main file, then inside the READ loop it does below processes.  
i. it does an update and end transaction on the main file (I have used a separate view for update)  
ii. Then uses a get to get the record again  
iii. Then uses a find on the same record.  
iv. Does some dependent file update  
v. Then some update on the main file.  
vi. Then end transaction for dependent file and the dependent file.

Now, my process got abended due to NAT3021 in between step V and VI. Since, end transaction was not done here, I was expecting a backout trasnaction on the files. I have given a backout transaction in case of any abend.

However, backout did not happen. The dependent file got updated.

NAT3021 is a new error to me that I had never faced before. Can NAT3021 cause a partial commit in adabas?

Can someone please help me with this.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 6, 2018, 3:36pm UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/2 "2018-02-06T15:36:11Z")

</div>

Could we see some of the code?

There are some curious steps in your task:

step i Why would you UPDATE and ET a separate view unless you had to read many fields from the main file yet only UPDATE one or two fields. Does your UPDATE reference the READ of the main file or the separate view?

Step iii Why would you do a FIND of the main file? Did you mean the dependent file?

Step v Which main file READ (GET) is referenced in the UPDATE?

How did you conclude the dependent file was updated?

As noted above, some actual code would be useful.

---

<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:** [February 6, 2018, 7:43pm UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/3 "2018-02-06T19:43:36Z")

</div>

What was the subcode on the 3021?

The error indicates a timeout, so to help you, we don’t need to see the entire program, but we do need the structure of your ET logic:

- Adabas access statements (READ, GET, FIND) with labels or line numbers, including loop-endings (END-READ, END-FIND)

- UPDATE, END TRANSACTION, BACKOUT TRANSACTION

- within the READ and FIND: any ACCEPT, REJECT, ESCAPE statements

- ET threshold logic

Something like

```auto
R.
READ main BY
  UPDATE (R.)
  END TRANSACTION
  G.
  GET main *ISN (R.)
  FIND main
    O.
    READ other
      UPDATE (O.)
    END-READ
  UPDATE (G.)
  END TRANSACTION
END-READ
```

---

<div class="post-metadata">

**Author:** ![Maitree\_Priyadarsini1](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Maitree\_Priyadarsini1](https://techcommunity.softwareag.com/u/Maitree_Priyadarsini1)\
**Post date:** [February 9, 2018, 7:58am UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/4 "2018-02-09T07:58:22Z")

</div>

Hi Steve,

Thanks for your reply. However, unfortunately I will not be able to share the code. To answer your questions…

I step i Why would you UPDATE and ET a separate view unless you had to read many fields from the main file yet only UPDATE one or two fields. Does your UPDATE reference the READ of the main file or the separate view? – update and end transaction is done on a same view.

Step iii Why would you do a FIND of the main file? Did you mean the dependent file? - The find is is done in a called subroutine…

Step v Which main file READ (GET) is referenced in the UPDATE? – The update is done on the get in which I used the update view…

Honestly, I dont have issue in the 3021 abend. All I need to know is if 3021 error can cause a partial commit?

---

<div class="post-metadata">

**Author:** ![Maitree\_Priyadarsini1](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Maitree\_Priyadarsini1](https://techcommunity.softwareag.com/u/Maitree_Priyadarsini1)\
**Post date:** [February 9, 2018, 8:08am UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/5 "2018-02-09T08:08:49Z")

</div>

Hi Ralph,

The subcode was 01 for the abend. I dont have any issue due to the abend. All I need to know is if a 3021 subcode 01 can cause a partial commit in the process.

and The below is the code structure.

R.  
READ main BY  
UPDATE (R.)  
END TRANSACTION  
G.  
GET main \*ISN (R.) (This get I did not do for any update. I used get as I did a ET in between the READ above. I had to get the record again)

subprogram started:  
FIND main (file same view is differnt as its in a subprogram)  
END find  
UPdate the main file  
O.  
READ other  
UPDATE (O.)  
END-READ  
subprogram ended  
control back to mainprogram and control stays in inline subroutine in the main program  
END TRANSACTION  
in line subroutine ended

control back to main flow of program  
Here I did another End Transaction to ensure all commit are done fine on the file and ET done for record separately

END-READ

So for each record, the flow will come through two end transactions.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 9, 2018, 2:54pm UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/6 "2018-02-09T14:54:58Z")

</div>

All I need to know is if a 3021 subcode 01 can cause a partial commit in the process.

The quick answer is “probably not”. More likely it is your program logic that is at fault.

How did you conclude that the error was between steps v and vi? What statement was the error pointing to?

Looking at your code:

subprogram started:  
FIND main (file same view is differnt as its in a subprogram)  
END find  
UPdate the main file  
O.  
READ other  
UPDATE (O.)  
END-READ  
subprogram ended

control back to mainprogram and control stays in inline subroutine in the main program

END TRANSACTION \<===  
in line subroutine ended

control back to main flow of program

If the error occurs after the END TRANSACTION (red arrow), The dependent file will have been ET’ed. Where in the code was the error pointing to?

---

<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:** [February 9, 2018, 5:28pm UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/7 "2018-02-09T17:28:07Z")

</div>

When Adabas returns the response code 21, reported to you by Natural as 3021, the current transaction has been backed out. That is, all updates since the prior ET have been reversed. There is no possibility that the transaction has been partially committed.

Your code contains two ETs, therefore two physical transactions. If you consider these two physical transactions to be a single logical transaction, then your logical transaction would be partially committed when an abend occurs after the first ET. You need to deal with this programmatically.

RC021 subcode 01 means you had a timeout. Possibly the total number of records processed in the FIND and the O.READ resulted in your not reaching the END TRANSACTION before time ran out. Or the O.READ exceeded your Hold Queue limit.

---

<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:40pm UTC](https://techcommunity.softwareag.com/t/nat3021-an-invalid-cid-value-was-detected/198009/8 "2021-04-02T15:40:04Z")

</div>


