View previous topic :: View next topic |
Author |
Message |
misi01 Advanced
Joined: 02 Dec 2002 Posts: 616 Topics: 171 Location: Stockholm, Sweden
|
Posted: Fri Jan 19, 2018 10:29 am Post subject: Return cursor to starting point |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 616 Topics: 171 Location: Stockholm, Sweden
|
Posted: Sat Jan 20, 2018 7:37 am Post subject: |
|
|
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
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Sat Jan 20, 2018 3:08 pm Post subject: |
|
|
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 |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 616 Topics: 171 Location: Stockholm, Sweden
|
Posted: Sun Jan 21, 2018 4:46 am Post subject: |
|
|
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 |
|
|
misi01 Advanced
Joined: 02 Dec 2002 Posts: 616 Topics: 171 Location: Stockholm, Sweden
|
Posted: Mon Jan 22, 2018 2:34 am Post subject: |
|
|
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 |
|
|
|
|