NAT3021: An invalid CID value was detected.

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.

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.

1 Like

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

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

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?

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.

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?

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.