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 Profile Log in to check your private messages Log in
 
Bliss

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

Senior Member


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

PostPosted: Wed Aug 17, 2011 10:33 pm    Post subject: Bliss
Reply with quote

...but you'll have to have to exercise your grey cells to realize why. (Why does "locate lab next" not wrap-around like find...)
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)"

parm = translate(space(parm, 1))

if parm = 0 then
  do
    eloc = '.a'        /* My default PF24 was "l .a", now it's "eloc" */
  end
else
  if parm = '' then
    do
      "ispexec vget (eloc) profile"
      if rc \= 0 then
        eloc = '.a'

      l    = word(eloc, 1)
      eloc = delword(eloc, 1, 1) l
    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


Enjoy and feel free to suggest improvements! icon_cool.gif
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:


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