LMDLIST: error while reading the list



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

LMDLIST: error while reading the list

Postby anjali_b » Wed Aug 12, 2009 5:47 pm

I'm using LMDLIST to do a simple scan for datasets starting with a particular qualifier. Following is the code that i have written to achieve this task.

ADDRESS ISPEXEC "LMDINIT LISTID(DTPDS) LEVEL("PKGNM")"               
ADDRESS ISPEXEC "LMDLIST LISTID("DTPDS") OPTION(TOTALS)"             
/*IF RC < 8 THEN DO                                                     
     SAY 'NO. OF DATASETS IN THE LIST IS ' ZDLDST                       
   END */                                                               
DO WHILE RC < 8                                                       
  ADDRESS ISPEXEC "LMDLIST LISTID("DTPDS") DATASET("DS") OPTION(LIST)" 
  SAY 'DATASET NAME ' DS RC                                             
END                                                                   
ADDRESS ISPEXEC "LMDLIST LISTID("DTPDS") OPTION(FREE)"               
ADDRESS ISPEXEC "LMDFREE LISTID("DTPDS")"                             
SAY ' '


LMDLIST seems to work fine only for the first element it retrieves. After that i am getting following error:
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
                               ISPF Dialog Error                               
 Command ===>                                                                   
                                                                    More:     +
 ******************************************************************************
 * ISPS108                                                                    *
 *                                                                            *
 * Invalid length                                                             *
 * Parameter 'DATASET' exceeds the allowable length.                          *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 * Current dialog statement:                                                  *
 * LMDLIST LISTID(ISR00023) DATASET(CMN.Y2KS.#004950.AS2) OPTION(LIST)        *
 *                                                                            *
 * Enter HELP command for further information regarding this error.           *
 * Press ENTER key to terminate the dialog.                                   *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *


I am unable to diagnose the "Invalid length" error. As per the services guide
LIST When you use the LMDLIST LIST option for the first time, the LMDLIST service generates an internal list. If you initialize the dataset-var to blanks, the first name in the internal list is returned. If you set the dataset-var to a data set name, that data set name is returned in dataset-var. If the LMDLIST service does not find the named data set the next data set in the list is returned. Each time you use the LMDLIST service with the LIST option it returns the next name from the internal list until it reaches the end of data. The LMDLIST service only includes the data set names meeting the criteria


As per this, code should fetch me the next dataset. Also, when i tried to initialize the DS to spaces at the beginning of my code (i.e. before LMDINIT) i ran into another error
                               ISPF Dialog Error                               
 Command ===>                                                                   
                                                                               
 ******************************************************************************
 * ISRLD016                                                                   *
 *                                                                            *
 * Data set not specified                                                     *
 * The data set parameter is required for the list option.                    *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 * Current dialog statement:                                                  *
 * LMDLIST LISTID(ISR00024) DATASET( ) OPTION(LIST)                           *
 *                                                                            *
 * Enter HELP command for further information regarding this error.           *
 * Press ENTER key to terminate the dialog.                                   *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 ******************************************************************************


Any suggestion or pointers in right direction will be much appreciated.

Thank you,
AB.
anjali_b
 
Posts: 15
Joined: Fri May 22, 2009 1:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: LMDLIST: error while reading the list

Postby MrSpock » Wed Aug 12, 2009 6:15 pm

ADDRESS ISPEXEC "LMDLIST LISTID("DTPDS") DATASET("DS") OPTION(LIST)"

DATASET should be the name of the variable where the dataset name will be stored, not the actual dataset name:

ADDRESS ISPEXEC "LMDLIST LISTID("DTPDS") DATASET(DS) OPTION(LIST)"
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: LMDLIST: error while reading the list

Postby anjali_b » Thu Aug 13, 2009 9:04 am

Thank you Mr Spock. With your solution pgm is now working fine.

Just to understand the concept clearly, when i had DATASET("DS") i was passing a variable to LMDLIST for populating dataset names which it did but only the first one, it failed to fetch the second one. When we used DATASET(DS), I am still passing DS as a variable so how is it different?

Much Thanks,
AB.
anjali_b
 
Posts: 15
Joined: Fri May 22, 2009 1:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: LMDLIST: error while reading the list

Postby GuyC » Thu Aug 13, 2009 3:38 pm

with ("DS") you pass the contents of variable , with (DS) you pass a name of a variable
LMDLIST needs a name of a variable as input

So if DS contains "CMN.Y2KS.#004950.AS2" , with ("DS") you would try to use the variable CMN.Y2KS.#004950.AS2 which gives you invalid length
If DS contains spaces you try to use the variable ' ', which gives you : The data set parameter is required
I can explain it to you, but i can not understand it for you.
GuyC
 
Posts: 315
Joined: Tue Aug 11, 2009 3:23 pm
Has thanked: 1 time
Been thanked: 4 times

Re: LMDLIST: error while reading the list

Postby anjali_b » Fri Aug 21, 2009 1:55 pm

Thanks GuyC for your response.

Your explanation helps.... 8-)
anjali_b
 
Posts: 15
Joined: Fri May 22, 2009 1:26 pm
Has thanked: 0 time
Been thanked: 0 time


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post