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

Rexx pgm to automatically put User-ID for changed lines


IBM Mainframe Forums -> TSO/ISPF
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
lewafa

New User


Joined: 13 Feb 2008
Posts: 3
Location: India

PostPosted: Wed Oct 14, 2009 11:04 pm
Reply with quote

For a long time, i am trying to write a Rexx/Clist program that will work inside COBOL programs to automatically put my user-id (8 chars long) in the 73-80 columns for all the new lines and modified lines.. But have not succeeded still .. :-(

Here is wat i wrote and the error its throwing.. i dont know much abt Rexx or macros.. so please help..

Code:

Code:
ISREDIT MACRO
ISREDIT CAPS ON
COL=73
CNST=USERID01

ISREDIT (SCLNUM, SCCNUM) = CURSOR
ISREDIT CURSOR = &SCLNUM &COL
ISREDIT (MEM) = MEMBER
ISPEXEC SELECT PGM(&MEM) PARM ('&NRSTR(&CNST),&COL')

SET ZEDSMSG = &STR(CONSTANT &CNST SET)
SET ZEDLMSG = &STR(MODIFIED LINES WILL BE MARKED WITH &CNST)

ISPEXEC SETMSG MSG(ISRZ000)
EXIT CODE(0)



Error message recieved:

Code:
COMMAND WRITE NOT FOUND
    6 *-* WRITE "COL"
       +++ RC(-3) +++
INVALID COMMAND NAME SYNTAX
    8 +++ ISREDIT (SCLNUM,SCCNUM) = CURSOR
Error running CONSTANT, line 8: unexpected "," or ")"
***


I understand that the code is not complete .. it might be totally wrong..
Please help me in making this code work as i need..

Thanks... :-)
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Wed Oct 14, 2009 11:57 pm
Reply with quote

If you are referring to editing a library member in ISPF and entering a single REXX/CLIST command to place your userid in positions 73-80 of that member, you could use the following code (if stored in a REXX library).

Code:

/*REXX*/                                             
'ISREDIT MACRO'                                       
USERD = USERID()                                     
ISREDIT "CHANGE P'========' "||USERD||" 73 80 ALL "   
ISREDIT "SAVE"                                       
ISREDIT "END"                                         
EXIT 1                                               


This code should be stored in a system REXX library under any legitimate name like ADDUID.

When in a library member, you would enter ADDUID on the command line.

If you don't want to save and/or end after the positions 73-80 have been changed you should remove ISREDIT "SAVE" & ISREDIT "END" lines from the REXX.
Back to top
View user's profile Send private message
lewafa

New User


Joined: 13 Feb 2008
Posts: 3
Location: India

PostPosted: Thu Oct 15, 2009 12:02 am
Reply with quote

Thanks dude.. But this code will put my id in all lines of that member.. i need to put my id to the lines that i insert/modify.

Hope i am clear.
Back to top
View user's profile Send private message
cpuhawg

Active User


Joined: 14 Jun 2006
Posts: 331
Location: Jacksonville, FL

PostPosted: Thu Oct 15, 2009 12:11 am
Reply with quote

If you have some constant in updated or added lines to a member, you could use something like this:

Code:

/*REXX*/                                                 
'ISREDIT MACRO'                                         
USERD = USERID()                                         
ISREDIT "EXCLUDE ALL"                                   
ISREDIT "FIND ALL CONSTANT"                               
ISREDIT "CHANGE P'========' "||USERD||" 73 80 ALL NX"   
ISREDIT "SAVE"                                           
ISREDIT "END"                                           
EXIT 1                                                   


Then the command would only update the non-excluded lines.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Thu Oct 15, 2009 12:40 am
Reply with quote

Why go through all this trouble when you can use MASK lines???
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 15, 2009 2:27 am
Reply with quote

in the event that MASK lines is too difficult,
you can invoke a script (edit macro) that:
Excludes ALL
loops thru 'locate change next' until RC <> 0
chg all '========' 'userid48' 73 nx
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Thu Oct 15, 2009 9:58 pm
Reply with quote

Interesting. I tried that but it didn't work. according to the help, LOC CHANGE looks for --CHG> lines which are only existing after a CHANGE command. So it does not flag typed in changes.

A google search for ISPF changed lines came up with a good macro called tag. Kind of old (1999) but it worked for me.
Back to top
View user's profile Send private message
prino

Senior Member


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

PostPosted: Thu Oct 15, 2009 11:24 pm
Reply with quote

Might want to play with this one

Code:
/* REXX edit macro to get information about line changes              */
/*** trace ?r ***************************************************** \| *
*               (C) Copyright Robert AH Prins, 2001-2001               *
************************************************************************
*  ------------+------+----------------------------------------------  *
* | Date       | By   | Changes                                      | *
* |------------+------+----------------------------------------------| *
* |            |      |                                              | *
* |------------+------+----------------------------------------------| *
* | 2001-05-15 | RAHP | Initial version                              | *
* |------------+------+----------------------------------------------| *
************************************************************************
* ELS is an edit macro that uses the 'line_status' command to display  *
* information about datalines in the member currently being edited.    *
************************************************************************
* Send questions, suggestions and/or bug reports to:                   *
*                                                                      *
* robert(a)prino(d)org                                                 *
*                                                                      *
* Robert AH Prins                                                      *
* Taboralaan 46                                                        *
* 8400 Oostende                                                        *
* Belgium                                                              *
************************************************************************
* 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/>  *
***********************************************************************/
"isredit macro"
"ispexec control errors return"
"isredit (LS) = line_status .ELS"

if rc \= 0 then
  do
    zedsmsg = ''
    zedlmsg = 'Mark the line for which you want to get information ' ||,
              'with the label ''.ELS'''

    "ispexec setmsg msg(ISRZ001)"
    exit 1
  end

if substr(ls, 1, 1) = '1' then
  line = ' - Line is an original line'
else
  if substr(ls, 2, 1) = '1' then
    line = ' - Line was created using the M(ove) line command'
  else
    if substr(ls, 3, 1) = '1' then
      line = ' - Line was created using the C(opy) or R(epeat) ' ||,
             'line command'
    else
      if substr(ls, 4, 1) = '1' then
        line = ' - Line was created using the M(ove) primary ' ||,
               'or macro command'
      else
        if substr(ls, 5, 1) = '1' then
          line = ' - Line was created using the C(opy) primary ' ||,
                 'or macro command'
        else
          if substr(ls, 6, 1) = '1' then
            line = ' - Line was created using the TE line command'
          else
            if substr(ls, 7, 1) = '1' then
              line = ' - Line was created using the I(nsert) ' ||,
                     'line command'

"isredit line_before .ELS = noteline (LINE)"

if substr(ls, 8, 1) = '0' then
  do
    line = ' - Line was not changed'
    "isredit line_before .ELS = noteline (LINE)"
  end
else
  do
    if substr(ls, 9, 1) = '1' then
      do
        line = ' - Data on line was typed over'
        "isredit line_before .ELS = noteline (LINE)"
      end

    if substr(ls, 10, 1) = '1' then
      do
        line = ' - Data on line was changed by the C(hange) or ' ||,
               'O(verlay) command'
        "isredit line_before .ELS = noteline (LINE)"
      end

    if substr(ls, 11, 1) = '1' then
      do
        line = ' - Data on line was changed by the (, ((, ) or ' ||,
               ')) command'
        "isredit line_before .ELS = noteline (LINE)"
      end

    if substr(ls, 12, 1) = '1' then
      do
        line = ' - Data on line was changed by the <, <<, > or ' ||,
                 '>> command'
        "isredit line_before .ELS = noteline (LINE)"
      end

    if substr(ls, 13, 1) = '1' then
      do
        line = ' - Data on line was changed by the TE, TF or ' ||,
                   'TS command'
        "isredit line_before .ELS = noteline (LINE)"
      end

    if substr(ls, 14, 1) = '1' then
      do
        line = ' - The line was renumbered'
        "isredit line_before .ELS = noteline (LINE)"
      end
  end
exit 1
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 -> TSO/ISPF

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top