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")"
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
"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
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