I need to delete 8 uncataloged datasets all on the same volser, preferably using IDCAMS and mask if possible like in my first delete statement below(which works but not for uncataloged volumes). I can hardcode them if required.
DELETE QARESM1.QAR12*.*12.GDG*.SID*.G000*V00 NVR MASK -
IDC2899I MASK PARAMETER NOT ALLOWED FOR NVR, VVR, TRUENAME, LIBENT,
IDC2899I VOLENT OR PARTITIONED DATA SET MEMBER DELETE
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12
SET MAXCC = 0
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0
You need to be sure the NVR or VVR's are truly orphaned by doing a DIAGNOSE of the volume which will report what the errors really are. If you're sure then you can also use DFDSS (ADRDSSU) to do a Physical DUMP DELETE of the uncataloged datasets NVR/VVR and DSCB's, and that does allow masking. Suggest running with PARM='TYPRUN=NORUN' initially to simulate and see what it'll do before removing the parm to do it for real.
Sometimes it also pays to print the VVDS of the volume and check what usercatalog the your 'uncataloged' datasets are in because the alias could have been repointed to another catalog, or the datasets may have been renamed to new HLQ whose alias is not in the same catalog. In this case you can sometimes just use a MERGECAT to move the entries to the correct catalog and they'll then be cataloged properly and visible.
Also, sometimes the uncataloged files can simply be recataloged if they are a result of a 'partial delete'. You just do a DEFINE with the RECATALOG parameter and it'll rebuild the usercatalog entry from information stored in the VVDS.