DETACH (Real Device)

Read syntax diagramSkip visual syntax diagram DETach rdevrdev1-rdev2VOLidvolidEQideqidFRomuserid*ALLSYSTEMTape-Only Optionsrdevrdev1-rdev2ldevldev1-ldev2VOLidvolidEQideqidFRomuserid*VOLidvolidFRomuserid*SYSTEM
Options for Tape Device Attached with ASSIGN
Read syntax diagramSkip visual syntax diagramUNloadLEave
Options for Tape Device Attached with NOASSIGN or MULTIUSER
Read syntax diagramSkip visual syntax diagramLEaveUNload

Authorization

Privilege Class: B

Purpose

Use DETACH (real device) to detach the following:
  • Local or remote real devices from one or more virtual machines
  • Local real devices from the host system
    Note: When detaching a remote device, specify its logical device address.

Operands

rdev
rdev1-rdef2
is a real device number, a list of real device numbers, or a range of real device numbers to be detached from the indicated user, from all users, or from the system. On a single command line, you may combine device numbers, lists of device numbers, and ranges of device numbers. Specify a real device number as one to four hexadecimal digits.
ldev
ldev1-ldev2
is a logical device number, a list of logical device numbers, or a range of logical device numbers to be detached from the indicated user. On a single command line, you may combine device numbers, lists of device numbers, and ranges of device numbers. Specify a logical device number as an L followed by one to four hexadecimal digits.
VOLid
indicates that a volume serial number, which must follow this keyword, is used to identify the real device. If the volume serial number is valid as an operand of the command (e.g., is a valid device number), specify VOLid to indicate that the operand is a volume serial.
volid
specifies the 1- through 6-character volume serial number of a real DASD.
EQid
indicates that a device equivalency ID, which must follow this keyword, is used to identify the real device. If the EQID is valid, and only one device with the specified EQID is attached to the target, the detach will be performed. If more than one device with the specified EQID is attached to the target, no detach will be performed.
eqid
specifies a string of 1–8 alphanumeric characters for a user-specified EQID or a string of 50 alphanumeric characters plus a dash ("-") for a system-generated EQID.
userid
*
identifies the virtual machine to which the device is currently attached. The specified user must be logged on, not in the process of logging on. If you are detaching a device from your own virtual machine, you may specify userid as an asterisk (*).
ALL
detaches a real device from all virtual machines without having to specify the user IDs. This operand can be used to detach devices attached with the MULTIUSER option. The ALL operand is not valid for devices attached to SYSTEM.
SYSTEM
detaches a DASD currently being used by CP for allocation and control.
UNload
detaches the tape device and automatically rewinds and unloads it. UNLOAD is the default if the tape was attached with the ASSIGN option.
LEave
detaches the tape device without rewinding and unloading it. The tape remains positioned as it was before issuing DETACH. LEAVE is the default if the tape was attached with the NOASSIGN or MULTIUSER option.

Usage Notes

  1. SET IMSG OFF will not suppress informational messages for this command.
  2. A previously attached device can be detached from a user, even if the device is still in use.
  3. When a device is detached from a user, all Concurrent Copy (CONCOPY) sessions associated with that device for that user are terminated in the storage control.
  4. When a device is detached, all data blocks associated with the device are removed from the minidisk cache.
  5. If you specify multiple device numbers or a range of device numbers on the DETACH (real device) command line, you receive an affirmative response for each device that is successfully detached and an error message for each device that cannot be detached.
  6. If you attempt to detach an active shared device from SYSTEM, you receive an error message indicating that the device is being shared by multiple users. In order to detach the device, each of the affected users must detach the device from their virtual systems.
  7. You cannot detach volumes in the CP-owned list that are in use by the system, shared by another system in an SSI cluster, or devices containing minidisks to which users are linked.
  8. If a tape device being detached was transferred to a user with the GIVE (Real Device) command, the LEAVE or UNLOAD option specified on the DETACH command overrides any option that was set when the GIVE command was issued. If LEAVE or UNLOAD is not specifically requested on the DETACH command, the option specified when GIVE was issued is processed. If no option was specified on either GIVE or DETACH, the tape is rewound and unloaded.
  9. If a device was attached using the CP ATTACH command and later detached, the system operator receives a response saying that the device was detached.
  10. For more information, see Usage Notes.
  11. When the primary or the secondary volume of a duplex pair is detached from a virtual machine, the response generated will indicate that the volume was either the primary duplex volume or the secondary duplex volume of the duplex pair. When the primary of a duplex pair is detached from the system, the response generated will indicate that the volume was the primary duplex volume of the duplex pair.
  12. A tape device attached with the SINGLEUSER option (the default) will automatically be unassigned by CP when the device is detached, unless the LEAVE option is specified on DETACH or the tape was attached with the NOASSIGN option.

    A tape device attached with both the SINGLEUSER and NOASSIGN options will not be unassigned by CP when the device is detached, regardless of whether the tape is currently assigned by a guest. In other words, CP will not change the ASSIGNED or UNASSIGNED status of the drive. It is the responsibility of the guest to issue the ASSIGN CCW when it needs the tape drive and to issue the UNASSIGN CCW when it is finished using the drive.

  13. A tape device attached with the MULTIUSER option will be unassigned by CP when the device is detached, even though MULTIUSER implies NOASSIGN. This prevents one user from unexpectedly locking out many other users from the drive.
  14. When detaching Parallel Access Volume DASDs from a guest, all dedicated alias Parallel Access Volumes associated with a particular base Parallel Access Volume must be detached from that guest before that base Parallel Access Volume can be detached. When detaching Parallel Access Volume DASDs through VOLID, it is going to detach the base and alias associated with the base automatically.
  15. When detaching Parallel Access Volume DASDs from the system, all system attached alias Parallel Access Volumes associated with a particular base Parallel Access Volume must be detached from the system before that base Parallel Access Volume can be detached. When detaching Parallel Access Volume DASDs through VOLID, it is going to detach the base and alias associated with the base automatically.
  16. When detaching RDEVICEs using an EQID, if more than one device exists with the specified EQID, no detach will be performed. To avoid accidental detaches, some other unique identifier (such as the RDEV number) must be used in this situation.
  17. When a CP-owned DASD volume with SPOOL extents is detached from the owning system in an SSI cluster, an attempt will be made to automatically detach the volume from all other members in the SSI cluster.

Responses

The user who currently owns the device (if different from the primary system operator), the user who issues the DETACH (real device) command (if different from the owner of the device), and the primary system operator (if different from the user who issued the command) each receive messages indicating that the DETACH (real device) is successful.

Note: The type variable in the following responses is omitted when a range of device numbers or multiple device numbers are being reflected in the response.
In the responses below, the term type is one of the following:
Type Meaning
CTCA Channel-to-channel adapter
CTLR 3745 Communications Controller
DASD Direct access storage device
FCP SCSI device adapter
GRAF Display device
MSC Mass Storage Controller
OSA Open Systems Adapter
PRT Printer
PUN Card punch
RDR Card reader
SWCH Dynamic Switching device
TAPE Magnetic tape
DEV Any other device
LINE Communication line

Response 1:

{type vdev} DETACHED BY originator [PRIMARY DUPLEX  ]
{vdev…    }                        [SECONDARY DUPLEX]
{vdev-vdev}                        [PAV BASE        ]
                                   [PAV ALIAS       ]
                                   [HYPERPAV BASE   ]
                                   [HYPERPAV ALIAS  ]
is the response sent to the device owner (if the device owner is not the primary system operator). Note that the response refers only to the virtual device number (vdev) because this is the number by which the owner knows the device.

Response 2:

{type rdev} DETACHED {userid [vdev]} [PRIMARY DUPLEX  ]
{rdev…    }          {SYSTEM       } [SECONDARY DUPLEX]
{rdev-rdev}                          [PAV BASE        ]
{type ldev}                          [PAV ALIAS       ]
{ldev…    }                          [HYPERPAV BASE   ]
{ldev-ldev}                          [HYPERPAV ALIAS  ]
is the response issued to the originator of the DETACH (real device) command if the originator is not the owner of the device or devices. When the response is for a single device (rdev or ldev), the virtual device number, and possibly the duplex state of the device, the PAV state of the device or the HyperPAV state of the device will appear in the responses following the userid. Because the secondary volume of a duplex pair cannot be attached to the system, SECONDARY DUPLEX will only be issued when detaching from another user ID.

Response 3:

{type rdev} DETACHED {userid [vdev]} BY originator [PRIMARY DUPLEX  ]
{rdev…    }          {SYSTEM       }               [SECONDARY DUPLEX]
{rdev-rdev}                                        [PAV BASE        ]
{type ldev}                                        [PAV ALIAS       ]
{ldev…    }                                        [HYPERPAV BASE   ]
{ldev-ldev}                                        [HYPERPAV ALIAS  ]
is the response sent to the primary system operator if another user (the originator) issued the DETACH (real device) command. When the response is for a single device (rdev or ldev), the virtual device number, and possibly the duplex state of the device, the PAV state of the device or the HyperPAV state of the device will appear in the responses following the userid. The secondary volume of a duplex pair cannot be attached to the system, therefore SECONDARY DUPLEX will only be issued when detaching from another user ID.
Response 4:
{TAPE rdev} DETACHED userid BY originator {, TAPE VOLUME(S) UNLOADED    }
{rdev…    }                               {  TAPE VOLUME(S) NOT UNLOADED}
{rdev-rdev}

is the response issued to the system operator when one or more tape volumes are being detached.

Response 5:
TAPE vdev RETURNED
is the response the user receives when a tape drive given to another user through the GIVE command is returned.
Response 6:
TAPE rdev RETURNED TO userid vdev
is the response the primary system operator receives when a tape drive given to another user through the GIVE command is returned.
Response 7:
Detaching vdev has caused the termination of
  CONCOPY session(s) on device(s): vdev1...
is the response the device owner receives if the process of detaching the device causes the termination of Concurrent Copy (CONCOPY) sessions, and the device owner is the originator of the DETACH command. The response lists the virtual devices that are part of the terminated CONCOPY sessions.
Response 8:
Detaching vdev by userid has caused the termination
  of CONCOPY session(s) on device(s): vdev1...
is the response the device owner receives if the process of detaching the device causes the termination of Concurrent Copy (CONCOPY) sessions, and the device owner is not the originator of the DETACH command. The response identifies the originator of the DETACH command and lists the virtual devices that are part of the terminated CONCOPY sessions.
Response 9:
Detaching rdev has caused the termination of
  CONCOPY session(s) for userid userid
is the response the originator of the DETACH command receives if the process of detaching the device causes the termination of Concurrent Copy (CONCOPY) sessions, and the originator of the command is not the owner of the device. The response identifies the user whose CONCOPY sessions have been terminated.
Response 10:
Detaching rdev by userid1 has caused the termination
  of CONCOPY session(s) for userid userid2
is the response the primary system operator receives if the process of detaching the device from user userid2 causes the termination of Concurrent Copy (CONCOPY) sessions, and the system operator is not the originator of the DETACH command (userid1).

Messages

  • HCP048E No device with EQID eqid attached.
  • HCP048E No device with EQID eqid exists.
  • HCP135E Multiple devices with EQID eqid attached.
  • HCP135E Multiple devices with EQID eqid exist.