Retriveving given datasets from specific volumes



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

Retriveving given datasets from specific volumes

Postby dohara » Thu Apr 09, 2009 4:14 pm

Hello guys

I need to retrieve datasets matching a mask like: userid.*a.** from specific volumes (just like you do in 3.4 ispf, when you specify both the dset mask and the volser) I know IEHLIST but that pulls all the datasets from the given volser. So i looked into the catalog search interface in SYS1.SAMPLIB - IGGCSIRX and tried to customize the code to my needs but it seems the search interface only accepts dataset mask as input with no specific volser so it retrieves all the matching datasets from all the vols. (or at least i was unable to get my head around it) Then found out about ISPF LM services and LMDLIST seemed to be the best choice as LMDINIT has VOLUME option.

I put together the following code and it worked fine...

"ispexec lmdinit listid(abc) level("mask") volume(volname)"
Do forever                                                 
 "ispexec lmdlist listid("abc") option(list) dataset(dsn)"
 If rc = 0 then                                           
  Do                                                       
   Say dsn
  End                                                     
 Else leave                                               
End                                                       
"ispexec lmdfree listid("abc")"                   


... so i thought its enough to loop it through all the volumes i have but as turned out it is not that easy..

when i put it into a loop, the code works fine for the first volume only. Then i get no more datasets from the rest of the vols.

Code:

Do v = 1 to vol.0                                         
                                                           
"ispexec lmdinit listid(abc) level("mask") volume("vol.v")"
Do forever                                                 
 "ispexec lmdlist listid("abc") option(list) dataset(dsn)"
 If rc = 0 then                                           
  Do                                                       
   Say dsn                                                 
  End                                                     
 Else leave                                               
End                                                       
"ispexec lmdfree listid("abc")"                           
                                                           
End                                             



I free up the dslist id after each volume so it should create a new listid every time it gets called. Using trace, this is what happening whereas it is not working out. I get CC8 in LMDLIST indicating 'End Of Datast List', however, the volume does contain datasets matching the given mask.

The mask can be anything just like in 3.4. I used USERID.*
The below trace shows what happens when the 2nd vol is being scanned for dsets.

 9 *-* Do v = 1 to vol.0                                               
11 *-*  "ispexec lmdinit listid(abc) level("mask") volume("VOL.V")"     
   >L>    "ispexec lmdinit listid(abc) level("                         
   >V>    "USERID.**"                                                 
   >O>    "ispexec lmdinit listid(abc) level(USERID.**"               
   >L>    ") volume("                                                   
   >O>    "ispexec lmdinit listid(abc) level(USERID.**) volume("       
   >C>    "VOL.3"                                                       
   >V>    "E4DA18"                                                     
   >O>    "ispexec lmdinit listid(abc) level(USERID.**) volume(E4DA18"
   >L>    ")"                                                           
   >O>    "ispexec lmdinit listid(abc) level(USERID.**) volume(E4DA18)"
12 *-*  Do forever                                                     
13 *-*   "ispexec lmdlist listid("abc") option(list) dataset(dsn)"     
   >L>     "ispexec lmdlist listid("                                   
   >V>     "ISR00027"                                                   
   >O>     "ispexec lmdlist listid(ISR00027"                           
   >L>     ") option(list) dataset(dsn)"                               
   >O>     "ispexec lmdlist listid(ISR00027) option(list) dataset(dsn)"
   +++ RC(8) +++                                                       
14 *-*   If rc = 0                                                     
   >V>     "8"                                                         
   >L>     "0"                                                         
   >O>     "0"                                                         
18 *-*   Else                                                           
   *-*    leave                                                         
12 *-*  Do forever                                                     
20 *-*  "ispexec lmdfree listid("abc")"                                 
   >L>    "ispexec lmdfree listid("                                     
   >V>    "ISR00027"                                                   
   >O>    "ispexec lmdfree listid(ISR00027"
   >L>    ")"                               
   >O>    "ispexec lmdfree listid(ISR00027)"
22 *-* End                                 



Please shed some light on what I'm missing.

I would also like to know if there's a way to call CSI with volser and dataset mask as input. I was able to retrieve a whole lot of info through CSI but was not able to specify volume as input.

Thanks
David
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: Retriveving given datasets from specific volumes

 

Re: retriveving given datasets from specific volumes

Postby expat » Sat Apr 11, 2009 2:54 pm

If you get the volder in the output from CSI it is easy to filter on that too.

I read a file of the volumes that I want to include, and as each entry is processed the volser is compared against the list of wanted volsers.
expat
 
Posts: 382
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 1 time

Re: retriveving given datasets from specific volumes

Postby dohara » Sun Apr 12, 2009 5:09 pm

Hello Expat

Yes, that's how i'm doing it. Each dset is checked against the vol it resides on. If the vol is on my list, the dset is pulled for further processing.
Yet i'm courious if there's a way to scan the specific vols only. LMDLIST looked fancy for the task but i'm still unable to get this thing working.

It seems LMDLIST can't be called two times in a row in the same code ??

I tried the following code - without volser name - just to see if LMDLIST is able to process the given mask in two subsequent steps

mask = 'USERID.**'

"ispexec lmdinit listid(abc) level("mask")"
Do forever
"ispexec lmdlist listid("abc") option(list) dataset(dsn)"
If rc = 0 then
Do
Say dsn
End
Else leave
End
"ispexec lmdfree listid("abc")"

"ispexec lmdinit listid(efg) level("mask")"
Do forever
"ispexec lmdlist listid("efg") option(list) dataset(dsn)"
If rc = 0 then
Do
Say dsn
End
Else leave
End
"ispexec lmdfree listid("efg")"


As you see the above two attempts are exactly the same.
The result was that the first shot retrieved all the matching datasets while the 2nd did not. It produced RC8 indicating the Empty List.

Anyway CSI is great and quick and i'm happy not to allocate any extra dsets to start ISPF but now the above doesnt want to get out of my head and i'm mad to find a way around sorting it. Any idea is welcome

Thanks
David
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: retriveving given datasets from specific volumes

Postby dohara » Tue Sep 22, 2009 2:35 am

Hello all

Sorry i got this old post resurracted but it might be useful for someone.
If you take a read of the original post, you see i was struggling with LMDLIST as it does not seem to cope very well with handling various input
(dataset masks) through a loop.

Eventually i got this thing working by taking LMDLIST out of the main code and calling it as a function.

Something like:

Main code:

/* rexx */
mask.1 = 'USRID.FOUND.IT.*'
mask.2 = 'USRID.WEVER.*'
mask.0 = 2
Do a = 1 to mask.0
v = lmdsrc(mask)
Parse var v rc dsn
End


LMDSRC function:

/* rexx */
parse arg mask
"ispexec lmdinit listid(abc) level(&mask)"
Do forever
"ispexec lmdlist listid("abc") option(list) dataset(dsn) stats(yes)"
If rc = 0 then say = dsn
Else leave
End
"ispexec lmdfree listid("abc")"
Return rc dsn


Regards,
David
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time

Re: retriveving given datasets from specific volumes

Postby dohara » Tue Sep 22, 2009 2:49 am

Sorry, i messed up the main code in prev post.


Main code:

/* rexx */
mask.1 = 'USRID.FOUND.IT.*'
mask.2 = 'USRID.WEVER.*'
mask.0 = 2
Do a = 1 to mask.0
mask = mask.a
v = lmdsrc(mask)
Parse var v rc dsn
End


I hope it's ok this time...late hours....

These users thanked the author dohara for the post:
Balamurugan21 (Fri Dec 06, 2013 5:55 pm)
dohara
 
Posts: 42
Joined: Thu Apr 09, 2009 3:15 pm
Has thanked: 0 time
Been thanked: 1 time


Return to TSO & ISPF

 


  • Related topics
    Replies
    Views
    Last post