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

Flipping between locations in a member


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

Senior Member


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

PostPosted: Wed Jan 21, 2015 9:32 pm
Reply with quote

Ever had the need to flip between two locations while you're editing or viewing a member, like the generated assembler listing and the actual statements?

For as long as I can remember, I've used "l .A" assigned to PF24, but that obviously only takes you bake to the line labeled .A, and that's not what we want. So I came up with the following code:

Code:
/* REXX edit macro to swap between several location in source         */
/*** trace ?r ***************************************************** \| *
*               (C) Copyright Robert AH Prins, 2011-2011               *
************************************************************************
*  ------------------------------------------------------------------  *
* | Date       | By   | Remarks                                      | *
* |------------+------+----------------------------------------------| *
* |            |      |                                              | *
* |------------+------+----------------------------------------------| *
* | 2011-08-17 | RAHP | Initial version                              | *
* |------------+------+----------------------------------------------| *
************************************************************************
* ELOC is a REXX edit macro to swap the edit or view position between  *
* various locations in a file.                                         *
************************************************************************
* This program is free software: you can redistribute it and/or        *
* modify it under the terms of the GNU General Public License as       *
* published by the Free Software Foundation, either version 3 of       *
* the License, or (at your option) any later version.                  *
*                                                                      *
* This program is distributed in the hope that it will be useful,      *
* but WITHOUT ANY WARRANTY; without even the implied warranty of       *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         *
* GNU General Public License for more details.                         *
*                                                                      *
* You should have received a copy of the GNU General Public License    *
* along with this program. If not, see <http://www.gnu.org/licenses/>  *
***********************************************************************/
parse source source
parse value source with . . moi .

"isredit macro (parm) NOPROCESS"

"ispexec control errors return"

parm = translate(space(parm, 1))

if parm = 0 then
  do
    eloc = '.a'
  end
else
  if parm = '' then
    do
      "ispexec vget (eloc) profile"
      if rc \= 0 then
        eloc = '.a'

      l    = word(eloc, 1)
      eloc = space(delword(eloc, 1, 1) l, 1)
    end
  else
    do
      eloc = ''

      do i = 1 to words(parm)
        l = word(parm, i)
        w = translate(l, 'aaaaaaaaaaaaaaaaaaaaaaaaaa',,
                         'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

        if length(w) <= 6 &,
           w          = left('.a', length(w), 'a') then
          do
            "isredit (N) = linenum" l

            if rc = 0 then
              eloc = eloc l
            else
              do
                "ispexec vget (eloc) profile"

                zedsmsg = ''
                zedlmsg = 'Label' l 'not found in source,' moi,
                          'terminated. Current swap-set "' ||,
                          strip(eloc)'" has not been altered.'
                "ispexec setmsg msg(isrz001)"
                exit
              end
          end
      end
    end

"ispexec vput (eloc) profile"
"isredit l" word(eloc, 1)
exit

I've called it ELOC (for Extended LOCate) and assigned it to PF24.

To use it, you mark the lines that you want to switch between with labels of your choice (let's say .A, .AA, .S & .Q) and then give the initial command
Code:
ELOC .a .aa .s .q

after which each further invocation of ELOC (without any parameters) will flip/rotate the member between those labels.

To remove all labels and set PF24 back to (my) standard of L .A, I can enter
Code:
ELOC 0

Labels that are removed from the member being edited will result in ELOC not moving the data, i.e. it will act as a NOP and it has (very) limited error checking in that it will not accept non-existent labels when invoked with a list of labels.

Enjoy!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Fri Jan 30, 2015 6:59 am
Reply with quote

<hitchhiking> is awesome...Great!!
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Fri Jan 30, 2015 10:31 am
Reply with quote

prino wrote:
Ever had the need to flip between two locations while you're editing or viewing a member, like the generated assembler listing and the actual statements? ...
I don't understand. A generated Assembler listing is in a different data set or PDS member than the data set you are editing. The two data sets or PDS members most likely will be in different ISPF sessions; you will be flipping between the sessions.

I do see a use for something like this. In an Assembler program I'm writing I'll have a DSECT, and I want to refer to the DSECT when I'm writing code that uses data elements in the DSECT. In my old age I can never remember the DSECT symbols when I'm writing the code that uses them. Senility catching up to me, I guess.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Fri Jan 30, 2015 3:51 pm
Reply with quote

steve-myers wrote:
prino wrote:
Ever had the need to flip between two locations while you're editing or viewing a member, like the generated assembler listing and the actual statements? ...
I don't understand. A generated Assembler listing is in a different data set or PDS member than the data set you are editing. The two data sets or PDS members most likely will be in different ISPF sessions; you will be flipping between the sessions.

I use it (mainly) when I look at PL/I listing datasets, when I've compiled the program with the LIST option to generate a pseudo-assembler listing.
steve-myers wrote:
I do see a use for something like this. In an Assembler program I'm writing I'll have a DSECT, and I want to refer to the DSECT when I'm writing code that uses data elements in the DSECT. In my old age I can never remember the DSECT symbols when I'm writing the code that uses them. Senility catching up to me, I guess.

That's my other use, flip between declarations of structures and the use of them.
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 copy the -1 version of a membe... TSO/ISPF 4
No new posts Searching for a member but don't know... TSO/ISPF 6
No new posts Looking For a PDS Member Without Open... PL/I & Assembler 10
No new posts Library member auto insert option TSO/ISPF 3
No new posts DataSet member creation failed with B... Java & MQSeries 15
Search our Forums:

Back to Top