Strovent SystemsSign in
Reference

IBM i "Cannot automatically select virtual device" (CPF8940, CPF87D7)

Why an IBM i Telnet connection closes before the Sign On display, how QAUTOVRT and a device name in use cause it, and what to ask for.

Sometimes a 5250 connection opens and then closes at once, with no Sign On display. On the IBM i, these messages explain it:

  • CPF8940: "Cannot automatically select virtual device." It comes from the QTVDEVICE job that handled your Telnet request.
  • CPF87D7: the same condition, sent to the system operator message queue (QSYSOPR) when the Telnet server could not create or select a virtual device.
  • TCP2504: the Telnet client session has ended and the connection is closed. You see this on the client side.

Everything below is on the host. There is nothing to fix in the terminal app, so give the administrator the exact message and the time.

Causes

IBM lists these causes for CPF87D7:

  1. The QAUTOVRT system value was exceeded. QAUTOVRT is the maximum number of virtual devices the system will create automatically. A device counts as in use when its status is active or sign-on display. When the number of devices in use exceeds the maximum, new Telnet connections fail. If automatic configuration was never allowed, the maximum is 0 and the system cannot create any device.
  2. The device type requested is not correct for this system.
  3. The device name is already in use. A client can ask for a specific device name. If a device of that name is already in use, or exists with a different category such as a printer, the request fails.

How the host picks a device

  • If the client does not ask for a name, the system uses the next free generic display device. Generic devices are those attached to a QPACTL* controller, and automatic ones are named QPADEVxxxx.
  • If the client asks for a name, the device is created on a QVIRCD* controller, and it is used only when that exact name is requested.
  • Both kinds count against QAUTOVRT. If the value is not higher than the number of virtual devices that already exist, no new device can be created.
  • The Telnet server does not delete devices when sessions close. They stay and can be used again. When a client asks for an existing device by name, the server adjusts its attributes to match the request.

What the administrator can do

  • Show and raise QAUTOVRT. IBM suggests setting it to *NOMAX temporarily to check whether the limit is the cause.
  • List the device with WRKDEVD DEVD(device-name). Take option 5 to see its category, and option 8 to see its status.
  • If the device exists but is in the wrong category (for example a printer, when a display was requested), vary it off and delete it, or choose another name.
  • If the device is ACTIVE or in sign-on status, another session is using it. Use another name, or end that session.
  • If the device is VARIED ON or VARY ON PENDING, it may also be in use. Varying it off can free it.
  • Read the messages before CPF87D7 in QSYSOPR for other causes.

Setting QAUTOVRT to 0 stops devices being created, and it also stops CPF87D7 being sent. IBM notes this is useful when clients that reconnect automatically flood the message queue.

What you can do from the app

If you set a device name in the profile, try a different one, or leave the name empty so the system assigns a QPADEVxxxx device. A name stays busy while an old job still holds it. See 5250 display devices and device names.

Sources

Spotted a mistake? Email [email protected].