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

Calling a rexx macro by itself


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Wed Jul 30, 2008 11:13 am
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
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: 2358
Location: Israel

PostPosted: Wed Jul 30, 2008 11:25 am
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
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: 2358
Location: Israel

PostPosted: Wed Jul 30, 2008 11:38 am
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
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: 2358
Location: Israel

PostPosted: Wed Jul 30, 2008 12:10 pm
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

Global Moderator


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

PostPosted: Wed Jul 30, 2008 9:32 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top