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

Trying to use SRCHFOR using a macro


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

New User


Joined: 28 Oct 2013
Posts: 15
Location: India

PostPosted: Wed Mar 26, 2014 12:40 pm
Reply with quote

Hello,

I am trying to issue a srchfor command using macro facilities -

Code:
 ADDRESS ISPEXEC "EDIT DATASET('"DSN"') MACRO(SMMACRO)"


But it is just opening the PDS and does nothing. I think the macro is not even getting called, as I even changed the macro name to some name and I didn't even got an error for ex. "macro name not found" or something like that.

Can't I use macro like this ? Or a macro can only be used in members opened in edit mode ? And by members I mean PS files..
Back to top
View user's profile Send private message
Soumick Sarkar

New User


Joined: 28 Oct 2013
Posts: 15
Location: India

PostPosted: Wed Mar 26, 2014 12:52 pm
Reply with quote

I tried by myself and observed that it is working for EDIT and VIEW, but only when I am specifying the member name as well.

(Sorry for posting without experimenting)

But isn't there any other way for srchfor ?
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Wed Mar 26, 2014 1:51 pm
Reply with quote

Post your full code.
What is in your DSN? If its just your PDS name, the macro will not work. You have to be inside editor(inside a PDS member in VIEW or EDIT Mode) to make your macro work.
Lastly, is your macro SMMMACRO present in SYSPROC/EXEC libraries?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Mar 26, 2014 2:02 pm
Reply with quote

They are called EDIT MACROS because they can run when you edit a file.
If you want to run it on members of a PDS, you have to edit the members (and execute the macro) one by one using a loop.

Can you explain why you use the term "SRCHFOR" ?
It is used by the Search-For Utility, and there could be other ways than to run a macro to reach your goal.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Mar 26, 2014 2:10 pm
Reply with quote

publib.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/ISPZEM40/CCONTENTS?SHELF=ispzpm40&DN=SC34-4820-04&DT=20050712213335

Why do you need to make another macro over SRCHFOR? You can also do this via batch.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed Mar 26, 2014 2:12 pm
Reply with quote

Quote:
Lastly, is your macro SMMMACRO present in SYSPROC/EXEC libraries?


I suppose it was present otherwise he would got that error at the first place.
Back to top
View user's profile Send private message
Soumick Sarkar

New User


Joined: 28 Oct 2013
Posts: 15
Location: India

PostPosted: Wed Mar 26, 2014 2:16 pm
Reply with quote

Full Code :

Code:
LIBR = 'UINITB8.CLIST'                                         
ZWINTTL = 'COPY PANEL'                                         
"ISPEXEC LIBDEF ISPPLIB DATASET ID('"LIBR"')"                 
"ISPEXEC ADDPOP"                                               
"ISPEXEC DISPLAY PANEL(COP)"                                   
"ISPEXEC REMPOP"                                               
ADDRESS ISPEXEC "BROWSE DATASET('"DSN"(LIST)') MACRO(SAMMACRO)"


TheMFkid:
Yes, DSN contains only the DSN name not the member name. And I agree with you on this that it will not work like that. And yes, the macro SMMACRO is present in SYSPROC library.

Marso:
Quote:
They are called EDIT MACROS because they can run when you edit a file.
- i agree with you on this. And I was using the term "SRCHFOR" because I wanted to explore any way with which I can achieve the same functionality.

I guess macro is not the correct way, can you please guide me to the correct way ?

My aim is just to open a PDS issue a srchfor command for ex. "SRCHFOR ABC" and get the member names in which ABC is present.

According to my code a panel will open up and it will ask to enter the desired DSN name after entering the DSN name, the DSN will open up and that's it. I am just expecting to issue a SRCHFOR here.
Back to top
View user's profile Send private message
Soumick Sarkar

New User


Joined: 28 Oct 2013
Posts: 15
Location: India

PostPosted: Wed Mar 26, 2014 2:32 pm
Reply with quote

Code:
ADDRESS ISPEXEC "BROWSE DATASET('"DSN"(LIST)') MACRO(SAMMACRO)"


Please ignore this line as I was testing and forgot to change it back.

Please read this as -

Code:
ADDRESS ISPEXEC "EDIT DATASET('"DSN"') MACRO(SAMMACRO)"
Back to top
View user's profile Send private message
Ranjithkumar

New User


Joined: 10 Sep 2008
Posts: 93
Location: India

PostPosted: Wed Mar 26, 2014 2:52 pm
Reply with quote

Soumick

As Rohit mentioned ISRSUPC is already available in Batch. If you want to do this through REXX , you have to execute ISRSUPC module via REXX, which is what option 3.14 / 3.15 in ISPF Menu does.
Back to top
View user's profile Send private message
Soumick Sarkar

New User


Joined: 28 Oct 2013
Posts: 15
Location: India

PostPosted: Wed Mar 26, 2014 2:59 pm
Reply with quote

Oh.. All right. i will try that now. Thanks for helping out guys icon_smile.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Mar 27, 2014 5:42 am
Reply with quote

SRCHFOR is a primary command that can be issued from the member list display. It was not stated clearly by the OP, but I think the intent was to display a member list that indicated which members had the search text.

I have been interested in SRCHFOR for some time, so I took this on as a challenge.

I was able to do what you want with a modified member list panel, ISREPO01. (Yeah, I know that modifying ISPF product panels is frowned upon. I made my own copy).

My driving program:
Code:
/* rexx */                 
Address ISPEXEC           
mysrch = 'TEST'           
"VIEW DATASET(my.clist) PANEL(MYPEO01)"


The modified panel ISREPO01 has this just before the )PROC statement:
Code:
If (&mysrch ¬= &z)             
  &zcmd   = 'SRCHFOR &mysrch'   
  &mysrch = &z         
  .resp   = ENTER               


The member list is shown as:
Code:
 VIEW     PEDRO.MY.CLIST                                        String(s) found
 Command ===>                                                  Scroll ===> CSR 
    Name     Prompt          Size    Created           Changed            ID   
 . $DDL3    *Found             30   2011/01/12   2011/01/12 12:15:56    xxx 
 . $DDL6                       16   2011/01/25   2011/01/25 10:49:04    xxx 
 . $DDL7    *Found             32   2011/01/31   2011/01/31 14:26:04    xxx   
 . $DDL8    *Found             14   2011/02/10   2011/02/10 11:24:44    xxx   


Though, I think it might be easier to just teach your users how to use the SRCHFOR primary command.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Mar 27, 2014 5:55 am
Reply with quote

The driving program should be:
Code:
/* rexx */                 
Address ISPEXEC           
mysrch = 'TEST'           
"VIEW DATASET(my.clist)"
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 PRINTOUT macro PL/I & Assembler 0
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
No new posts SRCHFOR ‘string’ command inside P... TSO/ISPF 14
No new posts SRCHFOR with LMDLIST or LMMLIST TSO/ISPF 7
No new posts Issues with executing a REXX MACRO th... TSO/ISPF 4
Search our Forums:

Back to Top