MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Return cursor to starting point

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Fri Jan 19, 2018 10:29 am    Post subject: Return cursor to starting point Reply with quote

Kolusu - if you can think of a better title for my question, feel free to change it.

Assume I'm editing a dataset. The top line shown on the screen is line 53 in the file.
I place the cursor somewhere on line 60 and run an edit macro. This macro searches the dataset, does some processing and is finished. I now want to return to where I was before the macro was run.

I could simply do a locate on lne 60 to return to where I was originally, but this shifts the dataset view upwards.
What I would like to do is extract some ISPF variable (?) that tells me line 53 was the first line showing on the screen when the macro was run (so I can do a locate line 53 instead).
Is there any isredit/ispexec command that can achieve this ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Fri Jan 19, 2018 12:12 pm    Post subject: Reply with quote

misi01,

You need to have macro to save the position of the cursor and restore it back again after it is done
Code:

ISREDIT (LIN,COL) = CURSOR


And it is explained here

https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.3.0/com.ibm.zos.v2r3.f54em00/mcursor.htm
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Sat Jan 20, 2018 7:37 am    Post subject: Reply with quote

Not at work at the moment, but I'm wondering how that would work.

Imagine 2 scenarios; one where the top line of the file shown on the screen is line 53, and one where it's 54.
In both cases, the user places the cursor on line 60, column 20 and runs the macro. This, under the covers, jumps around in the file until it's finished.

Now, if I run the
Code:
'cursor = 60 20'


The cursor will be placed there. The question, what will the line number be for the top line shown? I searched for some possible zscreen? variable to use, but nothing seemed relevant.

I suppose what I'm asking for is how to retrieve the value 53/54 into a variable. Then I could theoretically do a locate 53 or 54, and then do the cursor = 60,20.

Update

Just found DISPLAY_LINES - without being able to test, could that be what I'm looking for ?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Sat Jan 20, 2018 3:08 pm    Post subject: Reply with quote

misi01 wrote:


I suppose what I'm asking for is how to retrieve the value 53/54 into a variable. Then I could theoretically do a locate 53 or 54, and then do the cursor = 60,20.

Update

Just found DISPLAY_LINES - without being able to test, could that be what I'm looking for ?


Label the linenum 53/54 using LINENUM

Code:
ISREDIT (VAR1) = LINENUM .ZCSR


And then issue top and use locate(var) to get back to line number 53/54
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Sun Jan 21, 2018 4:46 am    Post subject: Reply with quote

That won't work will it? Your code assumes (?) that the cursor is already on line 53, something I don't actually know.

Basically, assume you're editing the file, you do a couple of PF8's, maybe a down 3, an up 7. which line number is at the top of the screen?
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
misi01
Advanced


Joined: 02 Dec 2002
Posts: 616
Topics: 171
Location: Stockholm, Sweden

PostPosted: Mon Jan 22, 2018 2:34 am    Post subject: Reply with quote

DISPLAY_LINES did the trick. If the top line being shown was line 44, I did a
Code:

'(rad,kol) = DISPLAY_LINES'

before I did any other edit commands and the variable rad (row in English) contained the value 44. Once I was finished with the macro, the last I did was

Code:

'locate 'rad         
'cursor = .zcsr' v2     (v2 is the column where the cursor was when the macro was started)


and the resulting screen was excatly the same as when the user started the macro.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group