Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
JCL to delete the last 6 lines of all the members in a PDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SMS & VSAM
Author Message
rameshm

New User


Joined: 03 Jan 2006
Posts: 3

PostPosted: Tue Feb 21, 2006 2:37 pm    Post subject: JCL to delete the last 6 lines of all the members in a PDS
Reply with quote

I need a JCL to delete the last 6 lines of all the members in a PDS.

The PDS is having almost 900 members and we need to delete the last 6 lines from all the members
Back to top
View user's profile Send private message
References
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2039
Location: Israel

PostPosted: Tue Feb 21, 2006 3:08 pm    Post subject:
Reply with quote

Try this:

Create a REXX edit-macro, and call it 'DEL6'. Here is the code:
Code:
/* REXX */                                   
                                             
ADDRESS ISREDIT "MACRO PROCESS"               
                                             
ADDRESS ISREDIT "(LASTL) = LINENUM .ZLAST"   
LASTL6 = LASTL - 6                           
                                             
ADDRESS ISREDIT "DELETE "LASTL6 LASTL         
ADDRESS ISREDIT "END"                         
                                             
EXIT                                         


Run the following REXX to invoke the DEL6 macro against each member of the PDS.
Code:

/* REXX */                                                             
                                                                       
ARG PDS .                                                               
                                                                       
PDS = STRIP(PDS,"B","'")                                               
                                                                       
X = OUTTRAP("LIBMEM.")                         /* Trap output of TSO  */
 ADDRESS TSO "LISTDS '"PDS"' M"                                         
X = OUTTRAP("OFF")                                                     
                                                                       
DO I = 7 TO LIBMEM.0                                                   
  LIBMEM.I = STRIP(LIBMEM.I)                   /* Member name         */
  ADDRESS ISPEXEC "EDIT DATASET ('"PDS"("LIBMEM.I")') MACRO (DEL6)"     
  SAY I RC LIBMEM.I                                                     
END                                                                     
                                                                       
EXIT                                                                   
                                                                       


O.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SMS & VSAM All times are GMT + 6 Hours
Page 1 of 1