REXX to Edit 3rd Line of all members in PDS

IBM's Command List programming language & Restructured Extended Executor
shiitiizz
Posts: 16
Joined: Thu Dec 06, 2012 2:30 pm
Skillset: COBOL, PL1, IMS DB-DC, JCL
Referer: Internet

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

Code: Select all

/*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

Code: Select all

***************************** 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

Code: Select all

                          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

Code: Select all

  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 ****************************

User avatar
prino
Posts: 641
Joined: Wed Mar 11, 2009 12:22 am
Skillset: PL/I - CICS - DB2 - IDMS - REXX - JCL, most in excess of three decades
Referer: Google
Location: Vilnius, Lithuania
Contact:

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

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

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

User avatar
Pedro
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Skillset: ISPF
Referer: google
Location: Silicon Valley

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


  • Similar Topics
    Replies
    Views
    Last post