Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Display all the datasets of a particular letter -> REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Tue May 08, 2007 8:51 pm    Post subject: Display all the datasets of a particular letter -> REXX
Reply with quote

Hi All,

Iam trying to write a Rexx program. The concept is If i give provide a letter as an input the output should be the list of all the dataset which starts with the letter given as input.

For example if i give "A" as input for my rexx exec, the output should be all datasets that starts with the letter "A".

Like "ANF.MSGFILE
ANF.QUEUE
ANF.QUEUE.DATA
ANF.QUEUE.INDEX
AOP.AAOPEXEC
AOP.AAOPHFS
AOP.AAOPHJPN
AOP.AAOPMENU
AOP.AAOPMJPN
AOP.AAOPMOD1
AOP.AAOPPENU
AOP.AAOPPJPN
AOP.SAOPEXEC"


I have created a program which will display all the datasets with that particular HLQ, if i provide "HLQ" as input icon_lol.gif

Code:

/* REXX */                           
/*TRACE I*/     
                     
SAY "ENTER HLQ"                     
PARSE UPPER PULL HLQ                 
IF HLQ="" THEN DO                   
 HLQ=MEMLIST ; MEMLIST="*"           
END           
                     
UPPER HLQ                           
HLQ=STRIP(STRIP(HLQ,"T","*"),"T",".")
DUMMY = OUTTRAP("LISTCAT.","*")     
 
"LISTCAT LEVEL("HLQ")"             
LISTCATRC=RC                       
IF LISTCATRC?=0 THEN DO             
        DO N=1 FOR LISTCAT.0         
          SAY LISTCAT.N             
        END                         
          EXIT LISTCATRC             
         END           
DO N=1 FOR LISTCAT.0                         
      IF WORD(LISTCAT.N,1)= "NONVSAM" THEN , 
      PDSLIST.N= WORD(LISTCAT.N,3)           
  END                                         
     DO I=1 TO LISTCAT.0                     
      PDSLIST.I=STRIP(PDSLIST.I)             
    IF SUBSTR(PDSLIST.I,1,8)="PDSLIST." THEN 
      NOP                                     
      ELSE                                   
      SAY PDSLIST.I                           
                                             
     END                                     
 EXIT                                         


Could any one guide me.. to end up with a good solution. icon_rolleyes.gif

GThiru
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Tue May 08, 2007 11:32 pm    Post subject: Re: Display all the datasets of a particular letter -> RE
Reply with quote

I'd be a little leery of attempting to list datasets at a level below the first dataset high-level qualifier. The process could take some time and could result in a session time-out due to lack of virtual storage.

That being said, the only way that I know to list datasets below the first HLQ is to use ISPF Library Maintenance (LM) services, specifically the LMDINIT and LMDLIST services. As an example:

Code:

/* REXX */
"ISPEXEC LMDINIT LISTID(idv) LEVEL(A*)"
Do Forever
   "ISPEXEC LMDLIST LISTID("idv") OPTION(LIST) DATASET(dsvar)"
   If rc = 0 Then Say "'"dsvar"'"
   Else Leave
End
"ISPEXEC LMDLIST LISTID("idv") OPTION(FREE)"
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 12:35 pm    Post subject:
Reply with quote

Quote:
I'd be a little leery of attempting to list datasets at a level below the first dataset high-level qualifier. The process could take some time and could result in a session time-out due to lack of virtual storage.

I agree with what superk has said.
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 2:10 pm    Post subject:
Reply with quote

Hi Superk & Expat icon_exclaim.gif

Thans for the information... I wil try to modify the REXX program with the example provide. This clue may end up with an accurate output!

Meantime anyone could also guide me.. to add some more extract in it! icon_wink.gif

Once again Thanks a lot!
GThiru icon_lol.gif
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 3:15 pm    Post subject:
Reply with quote

Hi Superk

Hurray...... I executed the code it's working fine....
You are amazing Super(K) icon_cool.gif .

But i guess that single quotes should be killed

"ISPEXEC LMDINIT LISTID(idv) LEVEL('A*')"


Am i correct icon_question.gif

And could any give me an idea to Get the input from the user
Like

Say " Enter A letter to list Dataset"
Parse upper pull letter
DS="LETTER"||*
"ISPEXEC LMDINIT LISTID(idv) LEVEL('DS')

Is there any way to substitute the user input like mentioned above..
I tried but got errors only.. icon_sad.gif

Thanks & Regards
GThiru icon_lol.gif




[/img]
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 3:19 pm    Post subject:
Reply with quote

DS="LETTER"||*

Is this a typo, and did you mean to type

DS= LETTER||"*"


I usually use something like

SAY "ENTER DSNAME"
PULL DSN
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 3:49 pm    Post subject:
Reply with quote

Hey Expat icon_biggrin.gif

Iam trying to get the input from user to display the datasets
In Superk program we are defined in the value in Level, like above specified as "A", Right..

What iam trying to do is..

/*REXX*/
SAY "ENTER A LETTER TO DISPLAY DATASET"
PARSE UPPER PULL LETTER

Suppose iam getting the input value as "B"

Then over here iam concatenating LETTER ("B") with * and assigning it to DS. In order to display all datasets starting with B.

DS= LETTER||"*"

Now substituting DS in Level with in Single quotes..

"ISPEXEC LMDINIT LISTID(IDV) LEVEL('DS')"

DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN SAY DSVAR
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"



Could you please let me know whether iam clear in explaining the my doubt....

Thank u Expat icon_wink.gif

Thanks & Regards
GThiru icon_biggrin.gif
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 3:54 pm    Post subject:
Reply with quote

Hi Expat

But iam getting errors only and not the expected output if i execute the above mentioned REXX. icon_cry.gif

Thanks & Regards
GThiru
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed May 09, 2007 4:00 pm    Post subject: Re: Display all the datasets of a particular letter -> RE
Reply with quote

If

DS= LETTER||"*"

then

"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DS")"

or

"ISPEXEC LMDINIT LISTID(IDV) LEVEL("||DS||")"
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 4:07 pm    Post subject:
Reply with quote

Yes, but telling us that you are getting errors and not posting the error message is not too much help for us.

What errors are you getting, post an example of the error message or text for us to look at.

Again, as an aside, is it just habit of using the STRIP command, but I guess I'd usually code.

DS= STRIP(LETTER||"*")
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 4:58 pm    Post subject:
Reply with quote

Hi Superk & Expat

Thanks Dude i have tried using this options given by both of u... icon_smile.gif

Could you please try executing this.. icon_sad.gif

***************************** Top of Data ***************************
/*REXX*/
/*trace*/
SAY "ENTER A LETTER TO DISPLAY DATASETS "
PARSE UPPER PULL HLQ
DS=STRIP(HLQ||"*")
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("'DS'")"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN SAY DSVAR
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
**************************** Bottom of Data *************************

When i executed this i got the following output

4 *-* PARSE UPPER PULL HLQ
B
>>> "B"
5 *-* DS=STRIP(HLQ||"*")
>V> "B"
>L> "*"
>O> "B*"
>F> "B*"
6 *-* "ISPEXEC LMDINIT LISTID(IDV) LEVEL("'DS'")"
>L> "ISPEXEC LMDINIT LISTID(IDV) LEVEL("
>L> "DS"
>O> "ISPEXEC LMDINIT LISTID(IDV) LEVEL(DS"
>L> ")"
>O> "ISPEXEC LMDINIT LISTID(IDV) LEVEL(DS)"
7 *-* DO FOREVER
8 *-* "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
>L> "ISPEXEC LMDLIST LISTID("
>V> "ISR00005"
>O> "ISPEXEC LMDLIST LISTID(ISR00005"
>L> ") OPTION(LIST) DATASET(DSVAR)"
>O> "ISPEXEC LMDLIST LISTID(ISR00005) OPTION(LIST) DATASET(DSVAR)"
+++ RC(4) +++
9 *-* IF RC = 0
>V> "4"
>L> "0"
>O> "0"
10 *-* ELSE
*-* LEAVE
7 *-* DO FOREVER
12 *-* "ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
>L> "ISPEXEC LMDLIST LISTID("
>V> "ISR00005"
>O> "ISPEXEC LMDLIST LISTID(ISR00005"
>L> ") OPTION(FREE)"
>O> "ISPEXEC LMDLIST LISTID(ISR00005) OPTION(FREE)"
+++ RC(8) +++
***

And return code as 0, have i done any mistake... icon_cry.gif


What should i do...?

Thanks & Regards
GThiru
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 09, 2007 5:14 pm    Post subject:
Reply with quote

Try it again yourself, but use TRACE I

I've just run it, was notified of the problem, and then resolved it.


superk - I'm learning more and more about ISPF & LM services thanks to you.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed May 09, 2007 5:18 pm    Post subject:
Reply with quote

Try that: "ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"

O.
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 6:12 pm    Post subject:
Reply with quote

Hi All

Superk Trace was typo mistake.. Thanks dude... icon_smile.gif

Ofer Thanks a lot for the help... icon_smile.gif

Superk, Expat & Ofer....
With the help of you people i got the expected solution..

Hurrray! icon_biggrin.gif

Thanks & Regards
GThiru
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Wed May 09, 2007 6:18 pm    Post subject:
Reply with quote

expat wrote:
superk - I'm learning more and more about ISPF & LM services thanks to you.


I think that anyone who needs to deal with and manipulate dataset lists, ISPF statistics, and PDS's really needs to know how to use the LM services. Our storage management folks unfortunately don't, which I think is rather silly.
Back to top
View user's profile Send private message
GThiru

New User


Joined: 19 Feb 2007
Posts: 10
Location: Chennai

PostPosted: Wed May 09, 2007 7:07 pm    Post subject:
Reply with quote

Hi All

Here is the REXX program for your display, icon_lol.gif which will aslo create a dataset to store the output... & will be dis[layed ini browse mode after executing the REXX.


/*REXX*/
/*TRACE I */
SAY "ENTER A LETTER TO DISPLAY ALL THE DATASET"
PARSE UPPER PULL HLQ
USER = SYSVAR(SYSUID)
PDS =USER||'.DATASET.REPORT'
DATA = SYSDSN("'"PDS"'")
IF DATA = 'OK' THEN
DO
X = MSG('OFF')
"DELETE ('"PDS"')"
X = MSG('ON')
END

"ALLOC DD(DDIN) DA('"PDS"')",
" NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE",
"SPACE(2,1) TRA"

DS=STRIP(HLQ||"*")
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN
DO
SAY DSVAR
QUEUE " "DSVAR
N = QUEUED()

"ALLOC F(OUT) DS('"PDS"') MOD REUSE"
"EXECIO" N "DISKW OUT(FINIS "
"FREE F(OUT)"
END
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
ISPEXEC "BROWSE DATASET('"PDS"')"



Thanks all once again for the patience & guidence


Cheers!
GThiru icon_biggrin.gif
Back to top
View user's profile Send private message
vcjadhav
Warnings : 1

New User


Joined: 27 May 2008
Posts: 19
Location: India

PostPosted: Mon Apr 04, 2016 4:44 pm    Post subject: Reply to: Display all the datasets of a particular letter -> REXX
Reply with quote

This was really helpful. Thanks guys.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DUMP DATASETS VS TRACE DATASETS! lind sh CICS 4 Tue Dec 06, 2016 11:31 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us