Page 1 of 1

REXX to Edit 3rd Line of all members in PDS

PostPosted: Thu Aug 13, 2020 5:21 pm
by shiitiizz
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 ****************************

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

PostPosted: Thu Aug 13, 2020 9:58 pm
by prino
Unlike in some other languages, spaces in REXX are significant.

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

PostPosted: Thu Aug 13, 2020 9:59 pm
by NicC
It's 'MYDATA' not 'MY DATA'

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

PostPosted: Fri Aug 14, 2020 3:50 am
by Pedro
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.