View previous topic :: View next topic
|
Author |
Message |
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
What is a "REXX macro"?
Basically, in pure REXX language, iterative calls are allowed.
O. |
|
Back to top |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
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? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
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 |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
|