# AEIT: ENDFILE not handled

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

### AEIT: ENDFILE not handled

An AEIT abend means a CICS browse command, READNEXT or READPREV, ran past the end of the file and the program didn't handle the ENDFILE condition. The browse loop had no check for its normal end.


#### Other names for this code

Also written as `AEIT abend`, `CICS AEIT`, `abend AEIT`, `ENDFILE`, `CICS ENDFILE`, `AEIT ENDFILE`, `READNEXT end of file`.


### What it means

A CICS browse reads a file in key order. STARTBR sets the starting position, READNEXT reads forward, READPREV reads backward, and ENDBR ends the browse. When READNEXT is issued after the last record, or READPREV before the first one, CICS raises ENDFILE. EIBRESP2 is 90.

ENDFILE is the normal way a browse finds out it's finished. A well-written loop expects it. The default action, though, is to abend the task with AEIT. A program that codes `RESP(WS-RESP)` gets control back and can test for `DFHRESP(ENDFILE)`. Older programs use `HANDLE CONDITION ENDFILE(paragraph)`.

ENDFILE is different from NOTFND. NOTFND (abend AEIM) means a keyed request found no record, for example a STARTBR with a key above every key in the file. ENDFILE only comes from reading on through a browse.


### Common causes

- The READNEXT loop has no test for ENDFILE because the author expected the loop to stop on a key value first.
- The loop stops when the key changes, but the last group in the file is followed by no more records, so the next READNEXT hits the end.
- A HANDLE CONDITION ENDFILE was set in one program, and the browse runs in another program reached by LINK, where that handler isn't active.
- A READPREV loop runs back past the first record in the file.
- The program was changed from HANDLE CONDITION to RESP checks, and the ENDFILE branch was left out.


### How to find the problem

- The terminal message `DFHAC2206` names the transaction. In the dump, EIBFN shows READNEXT or READPREV, EIBRSRCE names the file and EIBRESP2 is 90.
- Run the transaction under CEDF and step through the browse to see the last keys read before the failure.
- Check whether the failure only happens for keys near the start or end of the file. That pattern points to a missing ENDFILE test.


### How to fix it

- Test the response after every READNEXT or READPREV. Put `WHEN DFHRESP(ENDFILE)` in the EVALUATE and leave the loop there.
- Issue ENDBR when the loop ends, whether it stopped on ENDFILE, on a key change or on a page-full count. You must also end the browse before you update the same file.
- When reading a range of keys, compare each record's key with the end of the range so the loop stops before it reaches the end of the file.
- If the browse is through a non-unique alternate index, handle DUPKEY in the same EVALUATE as a good read.


### What it looks like


```text
DFHDU0203I 10/18/2026 10:12:55 CICSPRD1 A transaction dump was taken for dumpcode: AEIT, Dumpid: 1/0071.
DFHAC2206 10:12:55 CICSPRD1 Transaction INQ5 failed with abend AEIT. Updates to local recoverable resources backed out.
```


### IBM documentation

[IBM documentation: AEIT](https://www.ibm.com/docs/en/cics-ts/6.x?topic=codes-aeit). 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

[AEIM NOTFND not handled Read →](https://wndsoftware.com/mainframe-errors/aeim)
[AEIO DUPKEY not handled Read →](https://wndsoftware.com/mainframe-errors/aeio)
[AEIP INVREQ not handled Read →](https://wndsoftware.com/mainframe-errors/aeip)
[AEIZ ITEMERR not handled Read →](https://wndsoftware.com/mainframe-errors/aeiz)
[AEIL DSIDERR (FILENOTFOUND) not handled Read →](https://wndsoftware.com/mainframe-errors/aeil)

### Questions


#### Is ENDFILE an error?

No. It is the expected end of a browse. It only becomes an abend when the program doesn't check for it.


#### What is the difference between ENDFILE and NOTFND?

NOTFND means a keyed request found no matching record, and leads to AEIM. ENDFILE means a browse read past the first or last record, and leads to AEIT.


#### Does the browse still need ENDBR after ENDFILE?

Yes. End every browse with ENDBR before the program updates the same file or reuses the browse.

[CICS transaction abends](https://wndsoftware.com/mainframe-errors/cics-abends) · [AEIS](https://wndsoftware.com/mainframe-errors/aeis) · [AEIU](https://wndsoftware.com/mainframe-errors/aeiu)

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