Okay, I found the answer, in the book. It says:

dataset-var
    The LMDLIST service uses this variable to establish a position in the list. 
To start at the beginning of the list set the dataset-var to blanks. To 
    start at a specific data set in the list set the dataset-var to the name of 
the data set. If the LMDLIST service does not find the data set you 
    specify, it returns the next data set in the list.


Note "establish a position".

You have to set DSNAME="" in your code before you enter the loop to start 
getting dataset names:

DSNAME = ""
  DO FOREVER
     "LMDLIST LISTID("LISTID") DATASET(DSNAME)"
     IF RC > 0 THEN
        LEAVE
/*
     SAY DSNAME
  END

This worked for me, I got two identical dataset lists from the same volume.

Best regards,

Gary Diehl

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to