View previous topic :: View next topic
|
Author |
Message |
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
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
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.
GThiru |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi Superk & Expat
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!
Once again Thanks a lot!
GThiru |
|
Back to top |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi Superk
Hurray...... I executed the code it's working fine....
You are amazing Super(K) .
But i guess that single quotes should be killed
"ISPEXEC LMDINIT LISTID(idv) LEVEL('A*')"
Am i correct
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..
Thanks & Regards
GThiru
[/img] |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hey Expat
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
Thanks & Regards
GThiru |
|
Back to top |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi Expat
But iam getting errors only and not the expected output if i execute the above mentioned REXX.
Thanks & Regards
GThiru |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
If
DS= LETTER||"*"
then
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("DS")"
or
"ISPEXEC LMDINIT LISTID(IDV) LEVEL("||DS||")" |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi Superk & Expat
Thanks Dude i have tried using this options given by both of u...
Could you please try executing this..
***************************** 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...
What should i do...?
Thanks & Regards
GThiru |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Try that: "ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"
O. |
|
Back to top |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi All
Superk Trace was typo mistake.. Thanks dude...
Ofer Thanks a lot for the help...
Superk, Expat & Ofer....
With the help of you people i got the expected solution..
Hurrray!
Thanks & Regards
GThiru |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
GThiru
New User
Joined: 19 Feb 2007 Posts: 10 Location: Chennai
|
|
|
|
Hi All
Here is the REXX program for your display, 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 |
|
Back to top |
|
|
vcjadhav Warnings : 1 New User
Joined: 27 May 2008 Posts: 19 Location: India
|
|
|
|
This was really helpful. Thanks guys. |
|
Back to top |
|
|
|