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
 

 

Dynamically searching a string within all PDS members

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
Krishnan85

New User


Joined: 01 Feb 2010
Posts: 2
Location: Chennai

PostPosted: Mon Feb 01, 2010 6:51 pm    Post subject: Dynamically searching a string within all PDS members
Reply with quote

Hi. I am a new to REXX and just trying to learn it.

With the limited knowledge I have in REXX functions, I have written the following segment to search all the members of a PDS for a string.

The string I want to search is in variable 'TYP'. In my case TYP = 'ABC'.

'MEM1' is the current member in the PDS.

Right now the PDS name and string to search are static, but moving forward, I'll be making it dynamic.

My purpose is solved but I want to search for the string passed in TYP dynamically as against a static find I have used in the code attached. I have currently made use of 'FIND ALL' command in my code to accomplish my purpose.

Main ISPF Edit Macro
Code:

"ISREDIT MACRO"                                                         
"ISPEXEC LMINIT DATAID(DSNM) DATASET('X.Y.Z') ENQ(SHR)"
"ISPEXEC LMOPEN DATAID(&DSNM) OPTION(INPUT)"                                                                               
MEM=''                                                                 
DO FOREVER                                                             
  "ISPEXEC LMMLIST DATAID(&DSNM) OPTION(LIST) MEMBER(MEM) STATS(YES)"   
  IF RC <> 0 THEN LEAVE                                                 
  TYP = 'ABC'                                                           
  ADDRESS ISPEXEC                                                       
  MEM1 = STRIP(MEM)                                                     
  'VPUT (MEM1,TYP)' SHARED                                             
  "EDIT DATAID("DSNM") MEMBER("MEM1") MACRO(SCH1)"                     
END                                                                     
"ISPEXEC LMMLIST DATAID(&DSNM) OPTION(FREE)"                           
"ISPEXEC LMCLOSE DATAID(&DSNM)"                                         
EXIT                                                                   

ISPF Edit Macro SCH1 :
Code:

"ISREDIT MACRO PROCESS"       
ADDRESS ISPEXEC 'VGET (MEM1)'
ADDRESS ISPEXEC 'VGET (TYP)' 
MEM1=STRIP(MEM1)             
TYP=STRIP(TYP)               
"ISREDIT FIND ALL 'ABC' "     
IF RC = 0 THEN               
DO                           
   SAY MEM1       
END                           
"ISREDIT CANCEL"             
RETURN 

Please let me know if more details are needed.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10277
Location: italy

PostPosted: Mon Feb 01, 2010 7:06 pm    Post subject: Reply to: Dynamically searching a string within all PDS memb
Reply with quote

any reason to reinvent the wheel ?
isn' t search for good enough for you?
Back to top
View user's profile Send private message
superk

Moderator Team Head


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

PostPosted: Mon Feb 01, 2010 7:31 pm    Post subject: Reply to: Dynamically searching a string within all PDS memb
Reply with quote

Krishnan, you're close. You can pass parameters to the ISPF Edit Macro, so the VPUT/VGET services aren't really needed. A few changes and your code should work:

1. Change for the calling program:
Code:

"EDIT DATAID("DSNM") MEMBER("MEM1") MACRO(SCH1)" 


to
Code:

"EDIT DATAID("DSNM") MEMBER("MEM1") MACRO(SCH1) PARM(TYP)" 


2. Change your macro:
Code:

"ISREDIT MACRO PROCESS"       
ADDRESS ISPEXEC 'VGET (MEM1)'
ADDRESS ISPEXEC 'VGET (TYP)' 
MEM1=STRIP(MEM1)             
TYP=STRIP(TYP)               
"ISREDIT FIND ALL 'ABC' "     
IF RC = 0 THEN               
DO                           
   SAY MEM1       
END                           
"ISREDIT CANCEL"             
RETURN


to:
Code:

"ISREDIT MACRO (TYP)"
"ISREDIT (MEM1) = MEMBER"
TYP = STRIP(TYP)               
"ISREDIT FIND ALL '"TYP"'"
IF RC = 0 THEN               
DO                           
   SAY MEM1       
END                           
"ISREDIT CANCEL"             
RETURN
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Tue Feb 02, 2010 2:03 am    Post subject: Reply to: Dynamically searching a string within all PDS memb
Reply with quote

Based on the description so far, I do not think your main program needs to be a rexx macro.
Back to top
View user's profile Send private message
Krishnan85

New User


Joined: 01 Feb 2010
Posts: 2
Location: Chennai

PostPosted: Tue Feb 02, 2010 4:42 pm    Post subject: Reply to: Dynamically searching a string within all PDS memb
Reply with quote

Superk,

Thanks a lot for your help. I tried incorporating the 'FIND ALL' instruction alone and it worked. Later, I also tried all the other changes and then realised that I can do it without VGET and VPUT.

I also have another query.

The following instruction passes one parameter,ie, TYP to the called program.
"EDIT DATAID("DSNM") MEMBER("MEM1") MACRO(MEMB2) PARM(TYP)"

Is there a similar way for me to pass two or more parameters? Else, do I have to go back to VPUT and VGET? Currently my need is to pass two strings, say TYP1 and TYP2, from the calling macro to the called macro.

Hope some one resolves this query as well.

Thanks in advance once again.
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Copying Panvalet members to PDS LOGESHWARAN K CA Products 4 Mon Mar 06, 2017 10:45 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am


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