REXX to Edit 3rd Line of all members in PDS



IBM's Command List programming language & Restructured Extended Executor

REXX to Edit 3rd Line of all members in PDS

Postby shiitiizz » Thu Aug 13, 2020 5:21 pm

Hi,
I am trying to write a REXX which will be passed a PDS as input. The REXX will read thru all the members, and will update the 3rd line of all the members
with some data.

My code is as below
/*REXX*/                                                                
MAC  = 'LN2'                                                            
INPUT  = 'TE.AA.YY.FTP.CTLCARDS.DECOM'                                  
            X = OUTTRAP(MEMS.)                                          
 /* TO GET THE MEMBER LIST FROM THE INPUT PDS */                        
            "LISTDS '"INPUT"' MEM"                                      
            X = OUTTRAP(OFF)                                            
DO I=7 TO MEMS.0                                                        
      MEMS.I = STRIP(MEMS.I)                                            
       SAY 'MEMBER:'MEMS.I                                              
ADDRESS ISPEXEC "EDIT DATASET ('"INPUT"("MEMS.I")') MACRO ("MAC")"      
END                                                                    
EXIT                                                                    


and the Macro is
***************************** Top of Data ******************************
  /* REXX */                                                            
  ADDRESS ISREDIT "MACRO PROCESS"                                      
  MYDATA = "AAAA"                                                      
  ADDRESS ISREDIT "LINE_AFTER 3 = (MY DATA)"                              
  ADDRESS ISREDIT "SAVE"                                                
  ADDRESS ISREDIT "END"                                                
  EXIT                                                                  
**************************** Bottom of Data ****************************


While executing, I am getting below error

                          ISPF Edit Macro Error                                
 Command ===>                                                                  
                                                                               
 ******************************************************************************
 *                                                                            *
 * Command in error . : LINE_AFTER 3 = (MY DATA)                              *
 *                                                                            *
 * Invalid parameter                                                          *
 * Extraneous or invalid parameter was specified for LINE_AFTER command.      *
 *                                                                            *
 *   Error message ID . : ISRE181                                             *
 *                                                                            *
 *   Last return code . : 20                                                  *
 *                                                                            *
 *   Macro executing  . : LN2                                                 *
 *                                                                            *
 * Press ENTER key to terminate the macro.                                    *
 *                                                                            *
 *                                                                            *
 *                                                                            *
 ******************************************************************************
                                                                               
                                                                               
   *DSLIST  DSLIST   -DSLIST                                                    


Request for suggestions on how to resolve this,

The expected output is that the 3rd line as shown below having XXXXXXXX SHOULD be replaced with MY DATA

  File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help            
 -------------------------------------------------------------------------------
 EDIT       TE.AA.YY.FTP.CTLCARDS.DECOM(AA157FTP) - 01          LN2 macro error
 Command ===>                                                  Scroll ===> CSR  
 ****** ***************************** Top of Data ******************************
 000001 I am testing this                                                      
 000002 Lets test this                                                          
 000003 XXXXXXXX                                                                
 000004 One more line                                                          
 000005 And one more                                                            
 000006 QUIT                                                                    
 ****** **************************** Bottom of Data ****************************
shiitiizz
 
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Has thanked: 3 times
Been thanked: 0 time

Re: REXX to Edit 3rd Line of all members in PDS

Postby prino » Thu Aug 13, 2020 9:58 pm

Unlike in some other languages, spaces in REXX are significant.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: REXX to Edit 3rd Line of all members in PDS

Postby NicC » Thu Aug 13, 2020 9:59 pm

It's 'MYDATA' not 'MY DATA'
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: REXX to Edit 3rd Line of all members in PDS

Postby Pedro » Fri Aug 14, 2020 3:50 am

Unlike in some other languages, spaces in REXX are significant.


In this case, as a quoted string, it is good rexx syntax. However, it is not good editor macro syntax. The message, "ISRE181 Extraneous or invalid parameter was specified for LINE_AFTER command", seems pretty clear.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post