Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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: 4650
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: 2086
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Historical/statistical details for me... elixir1986 TSO/ISPF 13 Wed Aug 30, 2017 9:02 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us