I am trying to list all the datasets which starts with certain qualifier ( will be fed to the rexx ) , I have the code for and it does work if i am giving only one qualifier as input but in case if i give multiple inputs for the second input , no records are fetched ( even though there are files which stats with that qualifier )
I did found a similar thread in the same forum but even i tried that but it didnt work for me (the below thread suggested to use LMDLIST in a seperate subroutine but i couldnt see any difference)
tso-ispf/topic1751.html
My Rexx code :
"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
"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
When i tried with TRACE I option , I am able to see for the first qualifier this code fetches all possible datasets starting with that qualifier but for the second qualifier "ISPEXEC LMDINIT LISTID(IDV) LEVEL(&QUAL)" gives RC(8) eventhough there are datasets which can be pulled for that qualifier
Is it like LMDLIST should not be used in a loop for multiple HLQ ?
Can anyone please guide me where i am going wrong .