My requirement is to read a list of HLQs with wildcard and list out the dataset names.
I tried to use the below code. But when a dataset does not exists, the below code exits the rexx because of the Leave command.
Is there a way to write the dataset does not exist message against the HLQ to the output file and proceed reading the next record in the input and list the files under the HLQ till end of the input file?
"ALLOC F(INPUT1) DA('"XX.XXX"') SHR " /* XX.XXX holds the list of qualifiers for which DSN need to be fetched */
"EXECIO * DISKR INPUT1 (STEM HLQ. FINIS"
"FREE F(INPUT1)"
DROPBUF 0
DO I=1 TO HLQ.0
QUALIFIER=STRIP(HLQ.I) /* FIND THE QUALIFIER FOR WHICH */
STAR='*' /* DS NEED TO BE FETCHED */
QUAL=QUALIFIER||STAR
CALL PULLDSN QUAL
END
N=QUEUED()
"ALLOC F(OUTDD) DA('"YY.YYY"') SHR "
"EXECIO" N "DISKW OUTDD (FINIS"
"FREE F(OUTDD)"
/************************ SUBROUTINE **************************************/
PULLDSN:
ARG QUAL
/* PULL THE LIST OF DATA SETS BASED ON THE QUALIFIER */
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&QUAL)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR) STATS(YES)"
IF RC = 0 THEN SAY DSVAR
ELSE LEAVE
END /* END OF FOREVER LOOP */
"ISPEXEC LMDFREE LISTID("IDV")"
QUEUE DSVAR
RETURN
Thanks
Prasanna G.