Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using REXX to get data where the cursor is positioned

Status
Not open for further replies.

zerobc

Programmer
Jul 19, 2011
2
US
I am trying to write a rexx macro that can be used on any TSO panel and will pull the string where the cursor is positioned. I want it to pull the data from the first blank to the last blank.

All I can find are ISPEDIT macros but I want this to work on any TSO panel.

I tried playing with "VGET (ZSCREENI ZSCREENC ZSCREENW)" but can't seem to get what I need.

Any suggestions would be helpful.
 
Try this

/* REXX */
'ISREDIT MACRO NOPROCESS (parm)'
'ISPEXEC CONTROL ERRORS RETURN'
'ISREDIT (CurLne, CurCol) = CURSOR'
'ISREDIT (LineX) = LINE' CurLne
String = 'Cursor is not on a string'
If CurCol > 0 then Do
Do CurCol = CurCol by -1
If CurCol < 2 | substr(LineX,CurCol,1) = ' ' then leave
End
parse var LineX . =(CurCol) String .
End
say String
 
But - as noted elsewhere - an edit macro will only work in edit so you need the ZSCREENx variables.


Nic
 
Thanks for the help. We got it with the following:

ADDRESS ISPEXEC
"VGET (ZSCREENI ZSCREENC)"

CURSOR = ZSCREENC + 1

IF SUBSTR(ZSCREENI,CURSOR,1) = ' ' THEN
SAY 'INVALID CURSOR POSITION'
ELSE DO
DO UNTIL SUBSTR(ZSCREENI,CURSOR,1) = ' ' | CURSOR = 1
CURSOR = CURSOR - 1
END

CURSOR = CURSOR + 1
FLD_LEN = POS(' ',ZSCREENI,CURSOR) - CURSOR
FIELD = SUBSTR(ZSCREENI,CURSOR,FLD_LEN)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top