IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Unable to retrieve Datasets Names using LMDLIST


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 97
Location: India

PostPosted: Wed Apr 14, 2021 12:05 pm
Reply with quote

Hi,
I am trying to fetch all datasets listed under a given Production HLQ. The objective is to classify them as VSAM, PDS, GDG.
To list all datasets, I have written the below REXX routine.

Code:
/*REXX */
HLQ = <production HLQ>
QUAL=HLQ||'.*'

ADDRESS ISPEXEC
COUNT=0

"LMDINIT DATAID(MYLIST) LEVEL("QUAL")"
DO WHILE RC=0
   "LMDLIST LISTID("MYLIST") OPTION(LIST) STATS(ON) DATASET(CURRDS)"
   SAY CURRDS

   COUNT = COUNT + 1
   IF COUNT = 2000 THEN DO
      TEMPDS = CURRDS
      "LMDFREE LISTID(MYLIST)"
      "LMDINIT DATAID(MYLIST) LEVEL("QUAL")"     
      CURRDS = TEMPDS
      COUNT = 0
   END
END

"LMDFREE LISTID(MYLIST)"


I am getting a time Abend error once I execute this in batch.
If I am executing for a batch of 2000 only, then it's executing fine.

Requesting your assistance in resolution.

Thanks
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Wed Apr 14, 2021 1:11 pm
Reply with quote

Timer abend, then you need to set the TIME job statement, i.e.TIME=NOLIMIT. Though that may not be allowed at your site. If not then try TIME=(1439).
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10801
Location: italy

PostPosted: Wed Apr 14, 2021 1:29 pm
Reply with quote

whatever You are doing the loop is just wrong

Code:
"LMDINIT DATAID(MYLIST) LEVEL("QUAL")"
DO WHILE RC=0
   "LMDLIST LISTID("MYLIST") OPTION(LIST) STATS(ON) DATASET(CURRDS)"
   SAY CURRDS


should look more like this

Code:
"LMDINIT DATAID(MYLIST) LEVEL("QUAL")"
if ( RC <> 0 ) then do
... process the error

end

do forever
  "LMDLIST LISTID("MYLIST") OPTION(LIST) STATS(ON) DATASET(CURRDS)"
  if ( RC <> 0 ) then do
    ... assuming end of list
    leave
    ... or PROCESS THE ERROR
  end 
  ...
  ...
  ...
 
end
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 97
Location: India

PostPosted: Wed Apr 14, 2021 3:50 pm
Reply with quote

Thanks for your response Wlly & Enrico.

I have changed the Loop as:

Code:
DO FOREVER
   "LMDLIST LISTID("MYLIST") OPTION(LOST) STATS(YES) DATASET(CURRDS)"

   IF RC <> 0 THEN DO
      SAY 'UNSUCCESSFUL LISTING. HENCE EXIT"
      LEAVE
   END
   .
   .
   <rest of codes>
END


This didn't alter the result. Also, I don't think adding time would make a difference because the Rexx is processing just about 2000 records & then calls the Fault Analyzer without any notification of error. Then it abends with S322.

Thanks
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 618
Location: Bamberg, Germany

PostPosted: Wed Apr 14, 2021 4:02 pm
Reply with quote

Add
Code:
//IDIOFF   DD DUMMY            Turn off Fault Anal.

to your JCL to avoid the Fault Analyzer. Also add what Willy has suggested.
Next, provide Msgs so we can have a closer look at it.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Wed Apr 14, 2021 6:39 pm
Reply with quote

Your syntax for both LMDINIT and LMDLIST are wrong.
This one works:
Code:
 HLQ ='whatever'                                                       
 QUAL=HLQ||'.**'                                                       
 ADDRESS ISPEXEC                                                       
 COUNT=0                                                               
 currds=''    /* maybe not need, but just in case */                   
 "LMDINIT LISTID(MYLIST) LEVEL("QUAL")"                                 
 if rc<>0 then exit xmsg('LmdInit rc' rc zerrlm)                       
 DO forever                                                             
    "LMDLIST LISTID("MYLIST") OPTION(LIST) STATS(YES) DATASET(CURRDS)" 
    if rc >8 then do                                                   
      say 'LmdList rc' rc zerrlm                                       
      leave                                                             
    end                                                                 
    if rc<>0 then leave                                                 
    SAY left(currds,44) left(zdlvol,6) zdldsorg                         
 END                                                                   
 "LMDFREE LISTID(MYLIST)"                                               
 exit xmsg('Done..')                                                   
XMsg: if arg(1)<>'' then say arg(1);return word(arg(2) 0,1)             

Besides you are right regarding TIME, I should have looked at the underlying problem instead of just the symptom.
Back to top
View user's profile Send private message
hankoerlemans

New User


Joined: 25 Jan 2018
Posts: 45
Location: Australia

PostPosted: Thu Apr 15, 2021 6:29 am
Reply with quote

Are you sure parsing DCOLLECT output wouldn't be quicker/easier ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 618
Location: Bamberg, Germany

PostPosted: Thu Apr 15, 2021 9:00 am
Reply with quote

hankoerlemans wrote:
Are you sure parsing DCOLLECT output wouldn't be quicker/easier ?

You would greatly skip the possibility of using wildcards for the qualifier.
Back to top
View user's profile Send private message
hankoerlemans

New User


Joined: 25 Jan 2018
Posts: 45
Location: Australia

PostPosted: Thu Apr 15, 2021 9:14 am
Reply with quote

Didnt see the FA reference :-(
Shouldn't be called for S322.
Free of charge sample for your sysprogs :

Code:

EXCLUDE(ABEND(S058,S0F3,S13E,  /* Exclude standard                   */
              S222,S322,S33E,  /* SLIP ACTION=NODUMP abends          */
              S422,S47B,S622,                                         
              S71A,S91A,SC1A))                                         


You can always override if need a dump for an unexpected loop.
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 97
Location: India

PostPosted: Thu Apr 15, 2021 2:05 pm
Reply with quote

Thanks all for your response.

As suggested by Joerg, I have updated JCL to avoid Fault Analyzer & modified the Rexx as suggested by Willy.

The result still threw a Time Abend with no error message from Fault analyzer. The only error message thrown is below:

Code:
IEA848I NO DUMP WAS PRODUCED FOR THIS ABEND, DUE TO SYSTEM OR INSTALLATION REQUEST
IEF450I E0015CHD JS0010 - ABEND=S322 U0000 REASON=00000000  973


Hence, LMDLIST is indeed taking a lot of time to list the Dataset names.

Thanks for all your help.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10801
Location: italy

PostPosted: Thu Apr 15, 2021 2:15 pm
Reply with quote

the dfsort docs have samples on how to process dcollect data
abd CBTTAPE file 206 has some rexx samples

for people who want to look at the expanded content of cbttape

github.com/mainframed/CBTTAPE
2 months old but more than enough to have an idea
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 618
Location: Bamberg, Germany

PostPosted: Thu Apr 15, 2021 5:57 pm
Reply with quote

If the request is for online Datasets only, consider using the VTOC command from the CBT collection. It's pretty easy to use:
Code:
TSO VTOC <vol> PR(N (DSN DSO)) NOH
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Thu Apr 15, 2021 8:25 pm
Reply with quote

If you do the same in ISPF 3.4, how many datasets do you see?
How many lines did the job produce?
How much time did your job consume?
Back to top
View user's profile Send private message
Learncoholic

New User


Joined: 20 Sep 2007
Posts: 97
Location: India

PostPosted: Fri Apr 16, 2021 12:27 pm
Reply with quote

Hi Willy,
ISPF 3.4 listed 1966910 records.
When I executed the REXX with TIME=5, it listed 899 records
When I executed the REXX with TIME=15, it listed 3099 records
When I executed the REXX with TIME=10, it listed 2002 records


Thanks
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Fri Apr 16, 2021 1:35 pm
Reply with quote

At least the process is working, though it is more resource heavy than I would have expected.
I assume that the datasets listed are different, not the same (group) repeated?
Please try once with TIME=NOLIMIT, keeping an eye on the job as it runs. You might run into JES output limit if you write to sysprint (spool).
I was considering IGGCSIRX as an alternative, but it cannot differentiate between PDS and sequential datasets.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Fri Apr 16, 2021 1:42 pm
Reply with quote

If this is something you have to do on a regular basis and the disks have similar volser, then I would suggest trying the VTOC program from cbttape.org file 112.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Fri Apr 16, 2021 4:20 pm
Reply with quote

Actually, I will strongly recommend a VTOC-centric solution, like CBT file 112, DCOLLECT or even IEHLIST. Using ISPF library services causes an allocate of each and every dataset, which could explain why it uses time.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 708
Location: Whitby, ON, Canada

PostPosted: Mon Apr 19, 2021 11:47 pm
Reply with quote

The catalog search interface is another option. IBM provides a sample program written in Rexx. IGGCSIRX, if I recall correctly. I use it when performance is critical.
Back to top
View user's profile Send private message
Willy Jensen

Active User


Joined: 01 Sep 2015
Posts: 495
Location: Denmark

PostPosted: Tue Apr 20, 2021 12:32 am
Reply with quote

I don't think you can determine PDS from the catalog. You can differentiate between GDS, GDG, VSAM and NONVSAM, so if they don't have any sequential datasets then I guess you could say nonvsam=pds.
If so then Catalog Search Interface is certainly fast.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 708
Location: Whitby, ON, Canada

PostPosted: Thu Apr 22, 2021 12:11 am
Reply with quote

Willy Jensen wrote:
I don't think you can determine PDS from the catalog. You can differentiate between GDS, GDG, VSAM and NONVSAM, so if they don't have any sequential datasets then I guess you could say nonvsam=pds.
If so then Catalog Search Interface is certainly fast.
Good point about the DSORG not necessarily being in the catalog. Another caution is that a migrated VSAM file can show as NONVSAM in a catalog listing. In cases like that I have used the HLIST command to make that determination without having to recall the data set.
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 618
Location: Bamberg, Germany

PostPosted: Thu Apr 22, 2021 12:58 am
Reply with quote

don.leahy wrote:
In cases like that I have used the HLIST command to make that determination without having to recall the data set.

All DFSMShsm user commands check every time against RACF AFAIK, I would suggest using the HSEND command instead.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts define 1 DCB parms for multiple outpu... JCL & VSAM 9
No new posts FTP datasets to server CLIST & REXX 13
No new posts retrieve volume records from decollec... DFSORT/ICETOOL 4
No new posts REXX allocated datasets in JCL CLIST & REXX 9
No new posts Copying large number of datasets to m... JCL & VSAM 17
Search our Forums:

Back to Top