View previous topic :: View next topic
|
Author |
Message |
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
I'm trying to read a string from current cursor postion. I got how to get the cursor postion using
ADDRESS ISREDTT '(ROW,COL) = CURSOR'
How can I read a string in an EDIT macro? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
ISPF editor assigns a "secret" label for the current cursor position, and names it .ZCSR.
You can then use the LINE command to retrieve the line's content.
O. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Joe,
Quote: |
How can I read a string in an EDIT macro? |
Once you have got the cursor position, you need to find the string and move it to a variable.
You can move the line to a variable using the foll code
Code: |
"ISREDIT (TEXTLINE) = LINE .ZCSR" |
Then you can set the limits and use SUBSTR to copy just the field.
Code: |
STRING = SUBSTR(TEXTLINE,START-POS,LENGTH) |
You will get better answers if you explain your requirement clearly. |
|
Back to top |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
I'm developing a tool to search for a string in a member of PDS. If I place cursor under the string to be searched an press F5 the macro should read that word and go to next occurrence of the word.
Please see my previous post for more info.
ibmmainframes.com/viewtopic.php?p=144122#144122
can I use space as a delimiter (instead of length) so that I can get the word. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Joe,
Quote: |
If I place cursor under the string to be searched an press F5 the macro should read that word and go to next occurrence of the word.
|
Why should it go the next occurence of the word? or you want the tool to search the word in all the members of the PDS? Please mention your requirement clearly.
Quote: |
can I use space as a delimiter (instead of length) so that I can get the word. |
Yes, you can use any symbol as a delimiter. Do as mentioned below.
- get the cursor position
- find " " (space) using the foll statement
Code: |
"ISREDIT FIND NEXT .ZCSR .ZCSR ' '" |
- move the column no to a variable
Code: |
"ISREDIT (R1 C3) = CURSOR" |
then use the LINE and SUBSTR to get the word. Also please refer the manuals. |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Joe,
Quote: |
Please see my previous post for more info. |
As suggested in the previous post link, Read the manuals, understand the macro instructions and post if you still face any problem. |
|
Back to top |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
Yes I'm developing a tool to search a word (working storage varible) in a member. It is like FIND tool instead of giving the string as argument the string to be searched is read from the cursor position.
I'm stuck at another point I cannot find how to use PF keys in rexx macro
IF PFKEY = "PF04"
the above code is not working in macro. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
I believe you are mixing REXX, ISPF & Edit-Macro.
Have you read the relevant manuals?
O. |
|
Back to top |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
I'm not mixing I know the
IF PFKEY = "PF04"
will work only with panels what is its equivalent in macros I need to read the string when I press a PF key.
I'm new to REXX |
|
Back to top |
|
|
Aaru
Senior Member
Joined: 03 Jul 2007 Posts: 1287 Location: Chennai, India
|
|
|
|
Joe,
Quote: |
what is its equivalent in macros I need to read the string when I press a PF key. |
You are mixing evrything for sure.
From your previous post
Quote: |
If I place cursor under the string to be searched an press F5 the macro |
My understanding is that, you want to create a macro and then execute/invoke it using that a PF key. Am i correct? |
|
Back to top |
|
|
joejacob
New User
Joined: 21 Jun 2007 Posts: 14 Location: India
|
|
|
|
Yes, I got it right Thanks for the help. I mapped the PF key to my program. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2593 Location: Silicon Valley
|
|
|
|
Quote: |
I mapped the PF key to my program. |
Not sure what that means, just guessing...
But as an user, I get upset when the keys do not work as intended. Please do not change PF keys settings programmatically. PF key definitions should be defined through a keylist or through the xxxxPROF member and available when your tool is installed. If the user chooses to changes the keys, the changes should be honored. |
|
Back to top |
|
|
|