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

Get dataset name from pds


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

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Thu Mar 12, 2015 8:52 pm
Reply with quote

Hi Folks,

I like to call a REXX from ISPF member list panel.
The REXX need the dataset name of the pds (USERID.TEST.LIB).

Code:
EDIT              USERID.TEST.LIB               
Command ===>                                     
          Name     Prompt       Size   Created          ......   ...... 
_________ #ENQ                    21  2011/08/30
_________ #LISTDS                 22  2011/06/28
_________ #V                      10  2008/06/10
_________ ACC                      2  2009/10/28

Do you have any ideas, how can I get the dataset name auf the pds in the REXX ?

Thanks in advance for help icon_smile.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Thu Mar 12, 2015 9:59 pm
Reply with quote

This worked for me:
Code:
/* rexx */             
parse arg DSNAME       
Say 'DSNAME=('DSNAME')'
exit                   
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Mar 12, 2015 11:10 pm
Reply with quote

If I understand this correctly then you need the name of the PDS where your Rexx code resides. I was looking for the same thing on the internet and found this which gets you the PDS and member name:

Code:

/* rexx */                               
PARSE SOURCE . . MEM DDNAME CHANCE .     
IF CHANCE \= '?' THEN DO                 
  SAY 'FIND ME HERE:'                     
  SAY CHANCE'('MEM')'                     
  EXIT                                   
END                                       
X=OUTTRAP('LISTA.')                       
"LISTA ST"                               
X=OUTTRAP('OFF')                         
DO I=1 TO LISTA.0                         
  IF WORD(LISTA.I,1)=DDNAME THEN DO       
    IS=I-1                               
    LEAVE                                 
  END                                     
END                                       
DO I=IS TO LISTA.0 BY 2                   
  PATH=LISTA.I'('MEM')'                   
  ANSWER=SYSDSN("'"PATH"'")               
  ANSWER=SYSDSN("'"PATH"'")
  IF ANSWER='OK' THEN DO   
    SAY "I'M HERE! :)"     
    SAY PATH               
    LEAVE                 
  END                     
END                       
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Thu Mar 12, 2015 11:42 pm
Reply with quote

My previous post was a long code that I copied.

You may only need this code:
Code:

/* rexx */                               
PARSE SOURCE . . MEM . CHANCE .
  SAY CHANCE'('MEM')'         
  EXIT                         
END                           
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Fri Mar 13, 2015 6:32 pm
Reply with quote

Quote:
If I understand this correctly then you need the name of the PDS where your Rexx code resides

That is not what the original poster asked for. He asked for the PDS name where the selected member resides.
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Tue Mar 17, 2015 2:40 pm
Reply with quote

Hi Folks,

I try to tell you, what I want exactly...

I like to call a REXX from the Command line in the member list.
The REXX has no input parameters.

The REXX should change all members in the member list by calling an edit macro, running a CHANG ALL command for each member.

For that, it's necessary to get a list of all members of the PDS.
For getting all member names of the PDS, I would use LMMLIST.

The LMMLIST needs a DATAID, im getting with LMINIT.
The LMINIT now needs the name of a library, exactly the name of the PDS, I'm looking for.

That's it...

Is there another way to change all members of a PDS via command line, with one command, please tell me.


Many thanks in advance
icon_smile.gif
Back to top
View user's profile Send private message
David Robinson

Active User


Joined: 21 Dec 2011
Posts: 199
Location: UK

PostPosted: Tue Mar 17, 2015 3:55 pm
Reply with quote

I might be missing something here, but why don't you just use the ISRMBRS macro?
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2546
Location: Silicon Valley

PostPosted: Tue Mar 17, 2015 9:29 pm
Reply with quote

Quote:
I like to call a REXX from the Command line in the member list.

Are you purposefully trying to make this hard? I do not believe there are any ISPF services that will work from the command line in the member list (1).

You can accomplish what you want from ISPF option 3.4. Get your data set to show in the list. Invoke your rexx exec as a line command from the data set list. Use PARSE ARG to get the name of the data set, as I posted earlier.

(1) you can use the ZSCREENI variable to get the currently shown screen image, which has the data set name in the title line. You have to figure out how to parse the data in the variable.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Mar 17, 2015 9:39 pm
Reply with quote

see here for a COMPLETE WORKING application
REXX SCRIPTS,PANELS,MSGS,SKELS

www.ibmmainframes.com/viewtopic.php?t=60794&highlight=chgall
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Mar 17, 2015 9:39 pm
Reply with quote

see here for a COMPLETE WORKING application
REXX SCRIPTS,PANELS,MSGS,SKELS

www.ibmmainframes.com/viewtopic.php?t=60794&highlight=chgall
Back to top
View user's profile Send private message
oerdgie

New User


Joined: 22 Nov 2007
Posts: 64
Location: Germany

PostPosted: Tue Mar 17, 2015 11:21 pm
Reply with quote

Oh, I didn't know the ISRMBRS Marco. Sounds deeply interesting...

But it's a good objection, why not invoke the REXX from shown 3.4 dataset list ? This solves my problem.

Sometimes things can be so easy...

Thank's very much all of you for help ! icon_biggrin.gif
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 FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top