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

Send text at cursor position on an ISPF panel input field


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Domenic Ailati

New User


Joined: 11 Apr 2017
Posts: 4
Location: USA

PostPosted: Sun Jun 02, 2019 7:34 am
Reply with quote

Hi,

I would like to be able to press a function key on an ISPF panel, then have a specific text string sent at the cursor position.
The cursor would have to be on an input enabled field, obviously.
The function key would only be pressed if it's appropriate to do so as determined by the user.

An example use case would be:
Let's say a user is on 1.3.4 (Data Set List Utility panel), "Dsname Level" field and they press a function key. The function key would invoke a rexx program which would then send a specific text literal at the current cursor position.

I figured out how to assign the rexx program to a function key, and how to get the current cursor position, but i cannot seem to find any information on how to send text at the cursor position.

Code:

/* REXX */
address ispexec "vget (zscreeni screenc) SHARED"

say "cursor location="  zscreenc
say "screen image  =" 
say  zscreeni
exit


Could someone please provide further guidance or point me in the right direction.

Thanks
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Mon Jun 03, 2019 1:30 am
Reply with quote

Edit And Edit Macros Manual
Back to top
View user's profile Send private message
Domenic Ailati

New User


Joined: 11 Apr 2017
Posts: 4
Location: USA

PostPosted: Mon Jun 03, 2019 5:25 am
Reply with quote

Thanks for the response, but I believe there's been a misunderstanding.

I'm not in the ISPF editor; thus, an edit macro or ISREDIT would not be applicable in this situation.

From what I've read and have shown in the code, I would need to use the ISPF environment command processor, ISPEXEC.
Back to top
View user's profile Send private message
Willy Jensen

Active Member


Joined: 01 Sep 2015
Posts: 712
Location: Denmark

PostPosted: Mon Jun 03, 2019 12:56 pm
Reply with quote

See the .CURSOR statememt in the 'ISPF Dialog Developer's Guide and Reference' manual section 'Using ISPF control variables'
Have something like this:
&CNAME = .CURSOR
in the panel )PROC section.
Then you should know the variable name where the cursor is, and you can assign a value to the variable.
Though I must admit I haven't tried it myself.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Tue Jun 04, 2019 10:09 am
Reply with quote

(I am not working anymore, so cannot verify if this works in the data set list panel).

1. I found this to be useful... you can set a PF key to be 'NRETRIEV', which stands for 'name retrieve'. ISPF keeps a history of the names you have used and pressing the NRETRIEV key pulls names off of the stack in a LIFO order. To use, put the cursor in the name field and press the NRETRIEV key. The data set name is put in name field. It works in the browse and edit data set name panels.

If it does not work, let me know and I will open a requirement on IBM's developerworks site.


2. If you need to do this using your own logic, I suggest using a customized panel as Willy suggests.

a.
Code:

 /*in the panel )INIT section.  */
IF (&myretrev = &z)  /* unassigned */
    &myretrev = 0)
IF (&myretrev = 1)
   .CURSOR = DSNAME   
   &DSNAME = &MYDSN


b.
Code:

 /*in the panel )PROC section.  */
&CNAME = .CURSOR
IF (&CNAME = DSNAME and ZCMD = MYCMD)
   &MYDSN =  'pedro.jcl.cntl'  /*or call your rexx here */
   &myretrev = 1
Else
   &myretrev = 0
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Jun 04, 2019 11:58 am
Reply with quote

Here it seems we have a newbie who's trying to invent some kind of macro facility.

Let's ask the following questions:
  1. What happens if, no, make that "when", the user just presses the PF key willy-nilly? Users are idiots and "if it's appropriate to do so as determined by the user" will never apply...
  2. How does the PF key invoked exec know on which panel it is?
  3. How would the exec determine that the cursor is on an input field?
  4. How would the exec figure out the actual ISPF variable name used for that field on the panel?
'nuff said...

Anyone wants to bet against this topic going nowhere?
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Jun 05, 2019 9:15 am
Reply with quote

Quote:
Anyone wants to bet against this topic going nowhere?


Please do not discount my advice regarding NRETRIEV. It is a wonderful feature. Everyone should try it. (fyi. I asked for this feature sometime in the 1990's. whoot!)
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Wed Jun 05, 2019 4:16 pm
Reply with quote

Pedro wrote:
Quote:
Anyone wants to bet against this topic going nowhere?


Please do not discount my advice regarding NRETRIEV. It is a wonderful feature. Everyone should try it. (fyi. I asked for this feature sometime in the 1990's. whoot!)

I've set PF6 to NRETRIEV on every panel, and PF5 to that other wonderful piece of magic, AUTOTYPE, almost from the moment they came into existence.

But this topic will still go nowhere.
Back to top
View user's profile Send private message
Domenic Ailati

New User


Joined: 11 Apr 2017
Posts: 4
Location: USA

PostPosted: Thu Jun 06, 2019 7:25 am
Reply with quote

Thank you for the responses.

Quote:
1. I found this to be useful... you can set a PF key to be 'NRETRIEV', which stands for 'name retrieve'. ISPF keeps a history of the names you have used and pressing the NRETRIEV key pulls names off of the stack in a LIFO order. To use, put the cursor in the name field and press the NRETRIEV key. The data set name is put in name field. It works in the browse and edit data set name panels.
Tried the suggestion on the dsname field on data set list panel. It worked. I see the reference to REFLIST as the names are popped from the stack in the top right hand corner. thx.

----
Quote:
What happens if, no, make that "when", the user just presses the PF key willy-nilly? Users are idiots and "if it's appropriate to do so as determined by the user" will never apply...
Yes, this may happen. The macro is for personal use. You are right, I am an idiot sometimes and do make mistakes often, but I learn from failure.
Quote:
How does the PF key invoked exec know on which panel it is?
Yes, I don't want the PF key to know which panel it's on.
Quote:
How would the exec determine that the cursor is on an input field?
Yes, exec does not need to know. I would make the decision.
Quote:
How would the exec figure out the actual ISPF variable name used for that field on the panel?
Yes, after reading through the relevant sections in the ISPF Dialog Developer's Guide as suggested by Willy, I realized that some further head scratching would be necessary.
Quote:
'nuff said...
Yes, from a certain perspective, skepticism would be understandable
Quote:
Anyone wants to bet against this topic going nowhere?
Wrong, there's more than one way to skin a cat. I wrote a vbscript to do what I had envisioned. Mission accomplished.

- One regret I have is not explaining myself more clearly in my original post, but on the other hand I got a lot of invaluable food for thought.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Mon Jun 10, 2019 11:26 pm
Reply with quote

Here is some more food.

Did you look at the ZSCREENI and ZSCREENC variables? ZSCREENI contains the screen image, and ZSCREENC gives you the cursor position. That is what I use for all of my 'screen scrapes', because it works on *any* ISPF panel regardless of whether the field is input enabled or not. It takes a bit of work to parse ZSCREENI, but it is not that difficult.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Jun 11, 2019 1:05 am
Reply with quote

Domenic Ailati wrote:
I wrote a vbscript to do what I had envisioned. Mission accomplished.

And that runs on z/OS using z/OS PF keys? Somehow I don't think so...

For what it's worth, I've got a dual function (edit macro / TSO command) bit of REXX code that can be used to edit ISPF clipboards from within other edit macros, or access the ISPF clipboards from outside the ISPF editor. It actually modifies a panel on the fly!

Now try that with VBS on Windoze...
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top