Volume pending offline: why it happens and how to free it
To take a volume out of the system (for example, to initialize it or to unmount it in ZD&T), you issue V dddd,OFFLINE. If someone is using it, the command does not fail: the volume stays pending offline and only goes offline when nobody has it allocated. And that is the question: who is using it?
In this article I cause the pending offline with the SLOG00 volume from Archive the SYSLOG with XWTR, see who has it and free it step by step.
Do it with a test volume. If you put offline a volume with system data sets or one that others use, the jobs that need it will not be able to use it.
Preparing the test
SLOG00 has the user catalog USERCAT.VSLOG00 and the generation SYSLOG.DAILY.G0001V00 of the GDG SYSLOG.DAILY. To also have a normal data set on the volume, I create a small one with this job. As in the SYSLOG article, I use STORCLAS=SCNOSMS so that SMS respects the VOL=SER (this is a configuration specific to this ADCD version):
//IBMUSERP JOB (TEST),'CREATE TEST DS',CLASS=A,MSGCLASS=H,
// NOTIFY=&SYSUID
//* Create a small data set on SLOG00 for the pending offline test
//CREATE EXEC PGM=IEFBR14
//TESTDS DD DSN=IBMUSER.TEST.PENDING,DISP=(NEW,CATLG),
// UNIT=3390,VOL=SER=SLOG00,STORCLAS=SCNOSMS,
// SPACE=(TRK,(1,1)),RECFM=FB,LRECL=80


The job ends with RC 0 and the data set is on SLOG00, next to the catalog and the VVDS of the volume (SYS1.VVDS.VSLOG00).
Now I do what any user would do: from TSO (ISPF option 6) I allocate the data set to my session. It stays allocated until I free it with FREE:
ALLOC F(TESTDD) DA('IBMUSER.TEST.PENDING') SHR
And I use the catalog on the volume with a LISTCAT of SYSLOG.DAILY, which is in USERCAT.VSLOG00 thanks to the SYSLOG ALIAS. In the screenshots I run it from option 3.4, with listc ent(/) next to the data set; from option 6 it would be:
LISTCAT ENT('SYSLOG.DAILY')


The CATALOG address space keeps open the catalogs that have been used, even if nobody is using them now. This command lists the ones it has (message IEC348I); USERCAT.VSLOG00, on SLOG00, is in the list:
F CATALOG,ALLOCATED
Putting the volume offline
First, the device number of the volume. It is 0AAD, and STATUS A shows that it is already allocated:
D U,VOL=SLOG00
And I put it offline:
V 0AAD,OFFLINE
The VARY does not give an error: it answers IEF524I 0AAD, VOLUME SLOG00 PENDING OFFLINE, and the volume does not go offline (STATUS A-PND). D U shows its status:
D U,,,0AAD,1
Seeing who has it allocated
This is the key command. It shows the jobs, tasks or users that have the device allocated, with their name and their ASID:
D U,,ALLOC,0AAD,1Message IEE106I shows two: CATALOG (ASID 0011), the catalog address space, and IBMUSER (ASID 00B1), my TSO session. Both have to be freed, each one in its own way.

A TSO user
If a TSO user shows up, it has a data set of the volume allocated. The normal thing is to ask the user to free it or to log off. In my case it is me, so I free it in option 6:
FREE F(TESTDD)
And I check again:
D U,,ALLOC,0AAD,1
IBMUSER is gone: only CATALOG (ASID 0011) is left.
The catalog: CATALOG
If CATALOG shows up, it is the catalog address space, which has open a catalog on the volume (in this case USERCAT.VSLOG00) or the VVDS of the volume. Nobody is using it (it is important to check this), but CATALOG has it allocated.
It is freed with UNALLOCATE, which closes the catalog and removes it from the CATALOG address space:
F CATALOG,UNALLOCATE(USERCAT.VSLOG00)The order matters: IBM says to issue the VARY first and this command after it. MODIFY CATALOG does not lock the catalog, so, if it is issued before, any request can open it again.
CATALOG answers with IEC351I and IEC352I (MODIFY COMMAND ACTIVE and COMPLETED) and, as nobody has the volume allocated any more, IEF281I 0AAD NOW OFFLINE comes out: the volume goes offline by itself, without repeating the VARY.

D U,,,0AAD,1
Now the STATUS is F-NRD (offline and not ready) and the VOLSER is no longer shown.
Leaving it as it was
I put the volume online again (IEE302I 0AAD ONLINE) and check that the catalog works: with the LISTCAT, CATALOG opens it again by itself.
V 0AAD,ONLINE
LISTCAT ENT('SYSLOG.DAILY')


Finally, I delete the test data set.

Other causes
- A running job with a data set of the volume: D U,,ALLOC shows its name. You have to wait until it ends or cancel it.
- The VVDS of the volume: if after the UNALLOCATE D U,,ALLOC still shows CATALOG, it may have the VVDS open. F CATALOG,VUNALLOCATE removes all the VVDSs (you cannot choose one) and they are opened again when they are needed. In my case it was not needed.
- A mounted zFS on the volume: D OMVS,F shows which data set is mounted and where. You have to unmount it.
- A LNKLST library: you have to remove it from all the LNKLST sets (the active one and the others) and from LLA, as in LLA and LNKLST: Releasing a Library So You Can Delete It.
- System data sets in use (paging, spool...): the volume does not go offline while the system uses them.
Do not use V 0AAD,OFFLINE,FORCE as a shortcut: it leaves the device boxed, the I/O in progress is cut off at once and any new I/O gets a permanent error.
Summary
- D U,VOL=volser: the device number.
- V dddd,OFFLINE: if it stays pending offline (IEF524I), someone has it allocated.
- D U,,ALLOC,dddd,1: who has it.
- If it is a user or a job: ask them to free it, wait until it ends or cancel it.
- If it is CATALOG: F CATALOG,UNALLOCATE(catalog), always after the VARY. If it still shows up, F CATALOG,VUNALLOCATE for the VVDSs.
- The volume goes offline by itself (IEF281I) when nobody has it allocated.
References (z/OS 3.1)
- Displaying device status and allocation (MVS System Commands)
- z/OS DFSMS Managing Catalogs (PDF): MODIFY CATALOG, UNALLOCATE and VUNALLOCATE.
- A Practical Guide to ICF Catalogs (IBM Redbook)
- Unable to bring offline a volume containing system data sets allocated at IPL/NIP (IBM Support)