Terminal screen error

5250 error 0018: Key used to exit field not valid

5250 error 0018 means you pressed a data key with the cursor at the end of a field that must be left with a field exit key. The cursor doesn't move on by itself in that field, so press Field Exit, Field+, Field- or a cursor movement key.

Other names for this code

Also written as 0018, error 0018, 5250 0018, operator error 0018, key used to exit field not valid, field exit required, AS/400 error 0018.

What it means

Normally, when you type the last character of a 5250 field, the cursor jumps to the next input field on its own. A programmer can switch that off for a field with CHECK(FE) in the DDS, or with CHGINPDFT(FE). The field is then field exit required. After you type its last character, the cursor stays under that character until you press a field exit key. IBM's DDS reference counts Field Exit, Field+, Field- and the cursor movement keys as field exit keys. Any other key at that point is an error, and the display station shows 0018.

So 0018 mostly happens to quick typists. They fill a field, assume the cursor has moved on, and start the next value. The first character of the next value is refused.

Programmers use this check to stop data spilling between fields. In a field without it, one character too many lands quietly in the next field and both values end up wrong. With CHECK(FE), the extra character produces an error instead, and nothing reaches the next field.

Common causes

  • You filled the field and kept typing the next value, expecting the cursor to move on by itself.
  • You typed one character more than the field holds. The refused character may be a sign that your value is too long for the field.
  • The display file sets CHGINPDFT(FE) at file or record level, so every input field needs a field exit key, and you are used to screens that advance on their own.

How to find the problem

  1. Look at the cursor. It sits under the last character of a full field.
  2. Press Help while 0018 is on the error line to see the system's text for the error.
  3. In the display file source, look for CHECK(FE) on the field, or CHGINPDFT(FE) at record or file level.

How to fix it

  • Press Reset (also called Error Reset) to free the keyboard. In many PC emulators Reset is the left Ctrl key by default. The value you typed is still in the field.
  • Press Field Exit, Field+ or Field-, or a cursor movement key, to leave the field. Then type the next value.
  • If the refused character was meant to belong to this field, the value is longer than the field. Check the value before you go on.
  • For programmers, remove CHECK(FE) from fields where automatic advance is safe, and recreate the display file with CRTDSPF.
  • For programmers, keep CHECK(FE) on fields where a value that spills over would be costly, such as quantities and amounts next to each other.

Read this error in WND Terminal

For a visible 5250 error 0018 message, Explain this screen can help interpret the screen under IT’s configured AI policy. It does not establish the cause of a rejected host data stream. Preserve the exact status and follow the diagnostic steps in this article.

Try the WND Terminal sample with fictional data · 3270 emulator features and installation · 5250 emulator for IBM i

IBM documentation

IBM Personal Communications documentation. Use the documentation for your installed release.

This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.

Report a correction to WND Software.

Questions

Why doesn't the cursor move to the next field on its own?

The field is set up as field exit required with CHECK(FE). The cursor stays at the end of the field until you press a field exit key, so an extra character can't run into the next field.

Which keys count as field exit keys?

Field Exit, Field+, Field- and the cursor movement keys. The exact keys depend on your keyboard or emulator mapping.

Is 0018 the same as 0020?

No. 0018 means you pressed a data key at the end of a field exit required field. 0020 means you pressed Enter in a right-adjusted or signed numeric field before leaving it.