I'm not really sure what you mean here, so I'll try to offer as many thoughts as I can.
First of all, this is NOT going to be a REXX "thing" as much as it will be a TSO/ISPF or storage management "thing".
If you want to know if a dataset is cataloged, the
TSO LISTDS command will tell you, and will return back details such as the LRECL.
REXX has the
SYSDSN function which will tell you if the dataset exists.
REXX has the
LISTDSI function which will tell you if a given dataset exists, and if so sets a group of variables that you can review.
SMS (System Managed Storage) has the
LISTCAT command, which you can call to obtain all sorts of details.
Moving on the the world of ISPF, you have the
ISPF DSINFO service, which returns the same details that you see in an ISPF 3.2 or 3.4 command.
Using ISPF Library Management (LM) services, you have
LMDLIST to list dataset names.