Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Flipping between locations in a member

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Wed Jan 21, 2015 9:32 pm    Post subject: Flipping between locations in a member
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

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

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

Active User


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

PostPosted: Fri Jan 30, 2015 10:31 am    Post subject: Re: Flipping between locations in a member
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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri Jan 30, 2015 3:51 pm    Post subject: Re: Flipping between locations in a member
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts File Stauts 92 with member of PDS sandip_mainframe COBOL Programming 4 Fri Jun 10, 2016 12:06 pm
No new posts how to extract the member name ? jackzhang75 CLIST & REXX 1 Wed Feb 17, 2016 9:21 pm
No new posts Check if a member is present in libra... enrico-sorichetti All Other Mainframe Topics 1 Wed Feb 03, 2016 12:29 pm
No new posts Editing "member generations"... Ricardo Viegas TSO/ISPF 1 Tue Dec 29, 2015 7:27 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us