The DSLIST command does exactly what you are trying to do.
Examine the ISP command table in ISPF option 3.9 and study the definition of DSLIST. You want to replicate the exact same SELECT statement into your rexx program. Except, replace &ZPARM with the dataset prefix of your choosing.
I did something similar, but of course, I did not follow my own advice. I actually issued the DSLIST command:
/*-------------------------------------------------------------------*/
/* view DSLIST of the superc files */
/*-------------------------------------------------------------------*/
dslist_supr:
ispfcmd = "DSLIST '"|| superc_dsn || "'"
"DISPLAY PANEL(aaaaaaa) COMMAND(ISPFCMD)"
return