Read cursor position from ISPF Panel



IBM's Command List programming language & Restructured Extended Executor

Read cursor position from ISPF Panel

Postby Jeff R » Sat Dec 24, 2022 7:03 pm

Is is possible to read a the Cursor position from an ISPF Panel ?
I have a Panel that has multiple variables (L0 - L48) which are populated with values from within a REXX.
I would like the user to be able to position the Cursor on the first character of any of the fields and press enter and have the Cursor position read.
I will be able to determine the value of the field by Cursor position (row,column).
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Read cursor position from ISPF Panel

Postby Pedro » Sun Dec 25, 2022 5:54 am

You can use ISPF control variables to get the values you need. See the ISPF Dialog Developer's Guide and Reference

)PROC
&mycursor = .CURSOR  /* name of field where the cursor is */
&mycsrpos = .CSRPOS  /* offset within the field where the cursor is */
 
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Read cursor position from ISPF Panel

Postby Pedro » Sun Dec 25, 2022 8:10 am

re: "determine the value of the field"

Something like this:

&myvalue = TRANS(&mycursor
            'L0', &L0
            'L1', &L1
            'L2', &L2
            'L3', &L3)
 
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Read cursor position from ISPF Panel

Postby Jeff R » Tue Dec 27, 2022 12:23 am

Thanks Pedro...I had t get pretty creative with the TRANSLATE.
Next issue...my REXX drives through 3 Panels...we can call them PANEL1, PANEL2 and PANEL3 and they are used sequentially in the respective order, I need to be able to "go backward" (i.e. from PANEL3 to PANEL2 and from PANEL2 to PANEL1) and this is controlled via PF1...however when I am (for example) in PANEL2 and press PF1 I get :
Scenario #1 (REXX executed from SDSF within ISPF) "ISPF Tutorial Error Panel Display" and the following error :
The previous panel displayed has either a blank or a
help panel reference that is not valid. The application
displaying this panel has not defined a panel for a
tutorial table of contents. (The ZHTOP variable was not
set.) Notify your systems programmer.
pressing PF3 or entering END does return me to PANEL2...pressing PF3 (or END) again and I get :
ISF039I ERROR PROCESSING ISPF VDEFINE RC=12: Panel 'ISFPNO41' error
ISF039I Panel not found.
and the ISPF processor abends
Scenario #2 (REXX executed from ISPF Primary Option Menu) taken to "Table of Contents" in "ISPF Program Development Facility Tutorial"

How do I override PF1 when the REXX is executed to perform my instruction which is a SIGNAL to an internal LABEL...will this resolve Scenarion #1 ??
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Read cursor position from ISPF Panel

Postby Pedro » Tue Dec 27, 2022 2:54 am

The convention on ISPF is for PF1 to show help information. I think it is easier to use different keys than to try to override PF1.

And it probably makes your application more robust to provide help panels. You can set control variable .HELP in your )INIT section to set the name of the help panel.
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Read cursor position from ISPF Panel

Postby Pedro » Tue Dec 27, 2022 3:02 am

I have two separate suggestions.

1. Use PF10 and PF11. Those keys are normally set to LEFT and RIGHT. In the )PROC section, check &ZCMD for LEFT or RIGHT and then set &ZCMD to NEXT or PREV (otherwise you probably get some other error message). In the rexx program, check &ZCMD and process accordingly.

2. Have two output only fields, NEXT and PREV, near the top of the panel. When the user double clicks on one of them, check the cursor position and then provide logic in the rexx program to take it to the next panel.
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Read cursor position from ISPF Panel

Postby Jeff R » Tue Dec 27, 2022 3:08 am

yes, I can change the PF key, but this REXX is being written to replace a Roscoe RPF that has been in use for MANY years and my thought was to make the transition as transparent as possible...PF1 serves that purpose in the RPF.
is there a convenient way to override PFkeys ?...because I have all of mine (all 24) in use.
I do plan or eventually getting to HELP panels as they too are part of the current RPF...just one task at a time.
As for the NEXT and PREV...I will most likely use that for multiple screen panels (i.e. PANEL2/PAGE1...PANEL2/PAGE2).

Also...how do I paste a screen shot in a reply here ?
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Read cursor position from ISPF Panel

Postby Pedro » Tue Dec 27, 2022 8:29 am

re: .how do I paste a screen shot in a reply here?

I think, just use a text copy of the screen then use the 'Code' tags here and paste in the screen copy.
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Re: Read cursor position from ISPF Panel

Postby Jeff R » Tue Dec 27, 2022 8:33 am

yep...that works
Jeff R
 
Posts: 27
Joined: Fri Dec 09, 2022 6:59 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Read cursor position from ISPF Panel

Postby Pedro » Tue Dec 27, 2022 10:22 am

is there a convenient way to override PFkeys ?


fyi. pf keys are somewhat controversial.

It is common for each application to create its own application pool. Use the ISPF SELECT service to launch your rexx program:

Address ISPEXEC "SELECT CMD(myrexx) NEWAPPL(myap)"

Where 'myap' can be up to four characters of your choosing. To avoid conflicts with IBM, start with letters K-Z.

Using your own applid creates an empty variable pool, including your PFkeys. In this way, you can assign values to ISPF variable ZPF10 from your rexx, for example. Also, you do not have to worry about colliding with other programs defining a variable with a common name like 'dsname'.

It is somewhat controversial because users get annoyed by having to make their customizations in a bunch of places.
Pedro Vera
User avatar
Pedro
 
Posts: 672
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 51 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post