MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using LMDLIST on multiple masks

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Mon Oct 05, 2009 10:24 am    Post subject: Using LMDLIST on multiple masks Reply with quote

I am running into something starnge when executing a REXX program and am hoping someone can tell me how to resolve this.

I have a REXX command which will except multiple dataset masks
(i.e. A111111.G*, Z222222.G*). I am trying to return all the datasets with those masks using LMDLIST.

I build an array which holds the masks and then I use a DO statement to loop thru the masks.

With in the DO statement I have the following:
Code:

DO J = 1 to I
     "LMDINIT LISTID(LMD) LEVEL("DSNAME.J")
     Do Forever
            "LMDLIST LISTID("LMD") OPTION(LIST) DATASET(DSET)"
            IF RC > 0 then Leave
     END
     "LMDFREE LISTID("LMD")"
END

When I run this, I get different LISTIDs for each dataset mask
(This is OK).

When the A111111.G* occurs before the Z222222.G* in the array, I get the correct results. When the Z222222.G* occurs before the A111111.G* in the array, the datasets with the Z222222.G* mask are returned, but when the LMDLIST is executed for the A111111.G* mask, a return code of 8 is returned which kicks me out of the loop and doesn't return any datasets for that mask (even though there are datasets with that pattern).

Does anyone have a solution (other than sorting the datasets alphabetically) to this? Why does this happen?
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Tue Oct 06, 2009 1:53 am    Post subject: Reply with quote

You could presort the HLQ's
Code:

IF DSNAME.0 > 1 THEN                                             
  DO I1 = 1 TO DSNAME.0-1                                         
    DO I2 = I1+1 TO DSNAME.0                                     
      IF DSNAME.I1 > DSNAME.I2 THEN                               
        DO                                                       
          FIL = DSNAME.I1; DSNAME.I1 = DSNAME.I2; DSNAME.I2 = FIL
        END                                                       
    END                                                           
  END                                                             


However, this is a grossly inefficient method of sorting large numbers of variables in a stem. For larger numbers please use the external SORT product.
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Tue Oct 06, 2009 7:06 am    Post subject: Reply with quote

Thanks for the reply. However that is exactly why I don't want to sort if I don't have to. I could have a large number of data masks sent to me.

I am wondering why the LMDLIST works the way it does. I would think that every time the LMDLIST command is executed using a dataset mask that it would work independently of the last LMDLIST command.

Why would the LMDLIST not return values for a dataset mask just because of the order it was executed?
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Wed Oct 07, 2009 1:42 am    Post subject: Reply with quote

Try using this - I've added one line to reset the DSET variable before each iteration. It worked OK when I tested it.

Myself, I would use SYS1.SAMPLIB(IGGCSIRX) rather than this if there may be large numbers of requests to process.
Code:

DO J = 1 to I
    DSET = ''
     "LMDINIT LISTID(LMD) LEVEL("DSNAME.J")
     Do Forever
            "LMDLIST LISTID("LMD") OPTION(LIST) DATASET(DSET)"
            IF RC > 0 then Leave
     END
     "LMDFREE LISTID("LMD")"
END

_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Wed Oct 07, 2009 8:28 am    Post subject: Reply with quote

It worked! Great (and simple) solution!

You had mentioned the name of another program which I could use and I found it, but am not sure that this will fit my needs.

I am trying to write a program that will return all sequential files and PDS dataset/members given a list of masks. Once I have those captured, I will execute an edit macro on each one of these.

This is for doing mass changes when you have both sequential datasets and PDS members and you don't want to have to type out the full name of each dataset.

Thanks again for your input. Great solution!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group