Find datasets using multiple Qualifiers LMDLIST



TSO Programming, ISPF, SDF, SDSF and PDF, FTP, TCP/IP Concepts, SNA & SNA/IP etc...

Find datasets using multiple Qualifiers LMDLIST

Postby Balamurugan21 » Fri Dec 06, 2013 7:43 pm

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 .
Balamurugan21
 
Posts: 6
Joined: Tue Feb 14, 2012 2:29 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Find datasets using multiple Qualifiers LMDLIST

 

Re: Find datasets using multiple Qualifiers LMDLIST

Postby Akatsukami » Fri Dec 06, 2013 8:46 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day

These users thanked the author Akatsukami for the post:
Balamurugan21 (Fri Dec 06, 2013 11:03 pm)
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Find datasets using multiple Qualifiers LMDLIST

Postby Balamurugan21 » Fri Dec 06, 2013 9:39 pm

Thanks a lot Akatsukami . . . It worked once i cleared the variable ...
Balamurugan21
 
Posts: 6
Joined: Tue Feb 14, 2012 2:29 pm
Has thanked: 2 times
Been thanked: 0 time


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post