Page 1 of 1

Find datasets using multiple Qualifiers LMDLIST

PostPosted: Fri Dec 06, 2013 7:43 pm
by Balamurugan21
Hi ,

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    


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 .

Re: Find datasets using multiple Qualifiers LMDLIST

PostPosted: Fri Dec 06, 2013 8:46 pm
by Akatsukami
Remember to use the Code tags when posting code or data.

DSVAR is the starting point in the list. When you switch to another HLQ, you do not reset DSVAR to null (''), and therefore you are specifying a starting point not in the new list, resulting in an immediate RC=8.

Re: Find datasets using multiple Qualifiers LMDLIST

PostPosted: Fri Dec 06, 2013 9:39 pm
by Balamurugan21
Thanks a lot Akatsukami . . . It worked once i cleared the variable ...