# AEIO: DUPKEY not handled

Source: https://wndsoftware.com/mainframe-errors/aeio

### AEIO: DUPKEY not handled

An AEIO abend means a CICS READ, READNEXT or READPREV through a non-unique alternate index raised the DUPKEY condition and the program didn't handle it. DUPKEY means more records with the same alternate key follow the one just read.


#### Other names for this code

Also written as `AEIO abend`, `CICS AEIO`, `abend AEIO`, `DUPKEY`, `CICS DUPKEY`, `AEIO DUPKEY`, `duplicate key CICS alternate index`.


### What it means

A VSAM alternate index lets a program read a file by a second key, such as customer name instead of customer number. The program reads it through a path, defined to CICS as a file. If the alternate index was defined with NONUNIQUEKEY, several base records can share one alternate key.

When a READ, READNEXT or READPREV retrieves a record through such a path, and another record with the same alternate key comes after it, CICS raises DUPKEY. EIBRESP2 is 140. During a browse, DUPKEY comes back on every record in a group of duplicates except the last one. So a program reading three records for the same key sees DUPKEY, DUPKEY and then NORMAL.

DUPKEY works as a warning. The read itself has done its job and the record is in the program's area. Even so, the default action is to abend the task with AEIO, which often surprises people. A program that codes `RESP(WS-RESP)` gets control back and can test for `DFHRESP(DUPKEY)`.


### Common causes

- The program reads by alternate key with a plain READ and only expects one record per key. The first time two records share the key, the task abends.
- A browse loop through a path treats anything other than NORMAL as an error, so it fails on the first duplicate.
- The data changed. Two customers now share a phone number or a name, and an alternate index that was unique in practice no longer is.
- The CICS file was pointed at a path when the program expected the base cluster, or the alternate index was rebuilt as NONUNIQUEKEY.


### How to find the problem

- The terminal message `DFHAC2206` names the transaction. In the dump, EIBFN shows the READ, READNEXT or READPREV, EIBRSRCE names the file and EIBRESP2 is 140.
- Run `CEMT INQUIRE FILE(name)` to see the data set behind the CICS file. If it is a path, that is the alternate index in use.
- Run IDCAMS LISTCAT ALL against the alternate index. It shows whether the index allows non-unique keys.
- Run the transaction under CEDF to see the key on the failing read, then look for other records with the same alternate key.


### How to fix it

- Treat DUPKEY as a good read. In the EVALUATE after the command, put `WHEN DFHRESP(NORMAL)` and `WHEN DFHRESP(DUPKEY)` together.
- To get every record for an alternate key, STARTBR on the path with that key and READNEXT. DUPKEY means more follow. NORMAL means that was the last one, unless you stop sooner when the key changes.
- If the screen expects one record and there can be several, show a list for the user to choose from.
- If the key really must be unique, clean up the duplicates and rebuild the alternate index with UNIQUEKEY. After that, a WRITE through the path with a key already in use gets DUPREC (AEIN) instead.


### What it looks like


```text
DFHDU0203I 10/18/2026 14:33:08 CICSPRD1 A transaction dump was taken for dumpcode: AEIO, Dumpid: 1/0052.
DFHAC2206 14:33:08 CICSPRD1 Transaction CUS3 failed with abend AEIO. Updates to local recoverable resources backed out.
```


### IBM documentation

[IBM documentation: AEIO](https://www.ibm.com/docs/en/cics-ts/6.x?topic=codes-aeio). Use the documentation for your installed release.

[Report a correction to WND Software](https://wndsoftware.com/contact#message).

Last reviewed 2026-10-18 by the WND Software team. Written in our own words. For the full reference, check IBM’s CICS documentation for your release.


### Related codes

[AEIN DUPREC not handled Read →](https://wndsoftware.com/mainframe-errors/aein)
[AEIT ENDFILE not handled Read →](https://wndsoftware.com/mainframe-errors/aeit)
[AEIM NOTFND not handled Read →](https://wndsoftware.com/mainframe-errors/aeim)
[AEIL DSIDERR (FILENOTFOUND) not handled Read →](https://wndsoftware.com/mainframe-errors/aeil)
[AEIU ILLOGIC not handled Read →](https://wndsoftware.com/mainframe-errors/aeiu)

### Questions


#### Is the record valid after DUPKEY?

Yes. DUPKEY tells you more records with the same key follow. The record you asked for has still been read.


#### Why doesn't the last record with the key raise DUPKEY?

DUPKEY means another record with the same key comes next. The last one in the group has nothing after it with that key, so it returns NORMAL.


#### What is the difference between AEIO and AEIN?

AEIO is DUPKEY on a read through a non-unique alternate index. AEIN is DUPREC on a WRITE or REWRITE that would duplicate a unique key.

[CICS transaction abends](https://wndsoftware.com/mainframe-errors/cics-abends) · [AEIN](https://wndsoftware.com/mainframe-errors/aein) · [AEIP](https://wndsoftware.com/mainframe-errors/aeip)

[← All error codes](https://wndsoftware.com/mainframe-errors/)
