You might try to see if ARSXML can do this for you.
If you look at the .../bin/xml/samples directory you'll see some XML samples.
Try the following JCL....I probably have way too many STEPLIBs and other libraries, you might be able to get by with just barebones:
//STEP1 EXEC PGM=BPXBATCH,REGION=0M
//*
//STEPLIB DD DISP=SHR,DSN=ARS.ARSV850.SARSLOAD
// DD DISP=SHR,DSN=DSN.DB2VA10.SDSNEXIT
// DD DISP=SHR,DSN=DSN.DB2VA10.SDSNLOAD
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD *
PGM /usr/lpp/ars/V8R5M0/bin/arsxml
delete
-h ARCH850 -u odadmin -p donnybrook -v
-i /usr/lpp/ars/V8R5M0/bin/xml/samples/deletegroups.ebcdic.xml
//STDENV DD *
CLASSPATH=/usr/lpp/ars/V8R5M0/bin/xml/ODAdmin.jar:
/usr/lpp/java/J8.0_64/lib/core.jar
LIBPATH=/usr/lpp/ixm1a/IBM/xml4c-5_7/lib/:$LIBPATH
PATH=/usr/lpp/java/J8.0_64/bin:/usr/lpp/ars/V8R5M0/bin:$PATH
/*
Of course, one would edit deletegroups.ebcdic.xml to match the groups you want to delete.
Not sure, but you may want or need to delete the applications first.
In that case, use this as a sample:
applicationAdd.ebcdic.xml
All you need I think is the application name="Daily sales invoices" part of the XML.
Ed