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
 

 

Calling a rexx macro by itself

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
joejacob

New User


Joined: 21 Jun 2007
Posts: 14
Location: India

PostPosted: Wed Jul 30, 2008 10:36 am    Post subject: Calling a rexx macro by itself
Reply with quote

Is it possible to call a REXX macro by itself like pseudoconversational mode in CICS. If it is possible how can I do that ? I need to pass a parameter when the macro is called by itself
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jul 30, 2008 11:13 am    Post subject:
Reply with quote

What is a "REXX macro"?

Basically, in pure REXX language, iterative calls are allowed.

O.
Back to top
View user's profile Send private message
joejacob

New User


Joined: 21 Jun 2007
Posts: 14
Location: India

PostPosted: Wed Jul 30, 2008 11:21 am    Post subject:
Reply with quote

This is my code, this is to search for a word in a member. To search it I'e to place the cursor under the word and press PF4.

Code:

/*REXX*/                           
ADDRESS ISREDIT 'MACRO (PARM)'     
ISREDIT "(THELINE) = LINE .ZCSR"   
"ISREDIT (R1 C1) = CURSOR"         
"ISREDIT FIND NEXT .ZCSR .ZCSR ' '"
"ISREDIT (R2 C2) = CURSOR"         
STRING = SUBSTR(THELINE,C1,C2-C1)   
IF PARM = '' THEN                   
DO                                 
  "ISREDIT RESET LABEL"             
  "ISREDIT F FIRST" STRING         
END                             


I mapped my rexx program to PF4 and when I press PF4 the word is and cursor mover to first occurrence. Now on subsequent presses of PF4 the cursor should move to the next occurrence how can I do that? icon_confused.gif
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jul 30, 2008 11:25 am    Post subject:
Reply with quote

This is an ISPF Edit Macro written in REXX.

You can invoke an edit macro from itself (using the EDIT/VIEW services), but I can't see the benefit of it, in addition to the fact that it will probably cause an infinite loop.

What you need to do is to create a loop (DO instruction) and issue the FIND command until RC <> 0.

O.
Back to top
View user's profile Send private message
joejacob

New User


Joined: 21 Jun 2007
Posts: 14
Location: India

PostPosted: Wed Jul 30, 2008 11:35 am    Post subject:
Reply with quote

I changed the code like this
Code:

ADDRESS ISREDIT 'MACRO (PARM)'     
ISREDIT "(THELINE) = LINE .ZCSR"   
"ISREDIT (R1 C1) = CURSOR"         
"ISREDIT FIND NEXT .ZCSR .ZCSR ' '"
"ISREDIT (R2 C2) = CURSOR"         
STRING = SUBSTR(THELINE,C1,C2-C1) 
IF PARM = '' THEN                 
DO                                 
  "ISREDIT RESET LABEL"           
DO UNTIL RC <> 0                   
  "ISREDIT FIND" STRING           
END                               
END                               


But still I have a problem when I place cursor under say ISREDIT and press PF4 the cursor will go to first occurence of ISREDIT, but my requirement is on subsequent presses the cursor should go to next occurrence. Though every ISREDIT's are higlighted on the PF4 press on subsequent presses the cursor remains on the first ISREDIT only. I need a logic to move the cursor on next occurrence.
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jul 30, 2008 11:38 am    Post subject:
Reply with quote

Why do you need a new command for RFIND? Don't you have it allocated already to one of your keys?

O.
Back to top
View user's profile Send private message
joejacob

New User


Joined: 21 Jun 2007
Posts: 14
Location: India

PostPosted: Wed Jul 30, 2008 11:46 am    Post subject:
Reply with quote

Yes RFIND is allocated to PF5. But in my case when I press PF4 and again press PF5 it is working as I expected; but is it possible include the function of PF4 itself ?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Wed Jul 30, 2008 12:10 pm    Post subject:
Reply with quote

Yes you can, if you save the result of each FIND in an ISPF variable and re-invoke your macro with a different action to be taken based on the previous FIND (just like pseudo-conversational). Again, I can't see the practicality of such design in ISPF.

O.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Jul 30, 2008 9:32 pm    Post subject: Reply to: Calling a rexx macro by itself
Reply with quote

I think your problem is that you want to start at the top. The expected action is to start from the current location and find the next. When you get to the bottom, wrap to the top.

----
But, please accept the advice of the more experienced people, and just use RFIND.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 2 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm


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