MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Need a JCL te delete last 6 lines from all PDS members

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
aquarian
Beginner


Joined: 28 Sep 2005
Posts: 66
Topics: 17
Location: Mars

PostPosted: Tue Feb 21, 2006 1:46 am    Post subject: Need a JCL te delete last 6 lines from all PDS members Reply with quote

Hi,
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.
Do the needful
_________________
cheers,
Aquarian
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
aquarian
Beginner


Joined: 28 Sep 2005
Posts: 66
Topics: 17
Location: Mars

PostPosted: Tue Feb 21, 2006 5:07 am    Post subject: Reply with quote

I got the answer for the question
but the below JCL has to be submitted 900 times
can anyone provide the REXX routine

like stem.0
Code:

//E11439A JOB NOTIFY=&SYSUID             
//STEP1    EXEC PGM=SORT                 
//SYSPRINT DD SYSOUT=*                   
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD DSN=E11439.TOOL.PS,DISP=SHR
//SORTOUT  DD DSN=E11439.TOOL.PS,DISP=SHR
//SYSIN    DD *                         
  INREC FIELDS=(1,80,SEQNUM,2,ZD)       
  SORT FIELDS=(81,2,ZD,D)               
  OUTREC FIELDS=(1,80)                   
/*                                       
//STEP2    EXEC PGM=SORT                 
//SYSPRINT DD SYSOUT=*                   
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD DSN=E11439.TOOL.PS,DISP=SHR
//SORTOUT  DD DSN=E11439.TOOL.PS,DISP=SHR
//SYSIN    DD *                         
 SORT FIELDS=COPY,SKIPREC=6             
/*                                       
//STEP3    EXEC PGM=SORT                 
//SYSPRINT DD SYSOUT=*                   
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD DSN=E11439.TOOL.PS,DISP=SHR
//SORTOUT  DD DSN=E11439.TOOL.PS,DISP=SHR
//SYSIN    DD *                         
  INREC FIELDS=(1,80,SEQNUM,2,ZD)       
  SORT FIELDS=(81,2,ZD,D)               
  OUTREC FIELDS=(1,80)                   
/*                                       

_________________
cheers,
Aquarian
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Tue Feb 21, 2006 8:46 am    Post subject: Reply with quote

That's why edit macro exists for

I have ussually seen this, but it fully apply here.

How would you do it without REXX?

Answer:

While editing your member executing 'DEL all .zlast .zlast' and saving your dataset.

So code you macro as such... call it from your rexx, several ways to do it, the easiest is to do an ISPEXEC EDIT DATASET(.....) MACRO(LASTDEL) where lastdel would be:

Code:

ADDRESS isredit         
'MACRO'                 
'DEL all .zlast .zlast'
'builtin save'         
'builtin cancel'       
return                 

_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Tue Feb 21, 2006 8:57 am    Post subject: Reply with quote

I thought it was only for the last line...
a minor mod and we have:

Code:

ADDRESS isredit         
'MACRO'             
'(zl) = linenum .ZLAST'
zl = zl - 6 + 1         
'LABEL ' zl '= .FROM'   
'DEL all .from .zlast' 
'builtin save'         
'builtin cancel'       
return                 

_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Tue Feb 21, 2006 8:58 am    Post subject: Reply with quote

what about ?
Code:

..
"(lastl) = linenum .zlast"                           
from=lastl-5                                         
                                                     
'DEL all' from' .zlast'                               
..
Back to top
View user's profile Send private message
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Tue Feb 21, 2006 9:04 am    Post subject: Reply with quote

I see you wan to apply it to a full PDS, something like this should work, the idea remains, edit each member using the coded macro:

Code:

/* Rexx */
Parse Arg Dsn .

x = Outtrap('Mem.')                     
"LISTD '"Dsn"' MEMBERS"                 
x = Outtrap('OFF')                       
                                         
Do iMem = 1 To Mem.0                     
  If Mem.iMem = "--MEMBERS--" Then Leave
End                                     
                                         
Do iMem = iMem + 1 To Mem.0             
                                         
  Mem = Strip(Mem.iMem)                 

  DsnMem = "'"Dsn"("Mem")'"

  Address ISPEXEC ,
  "EDIT DATASET('"Dsname"') MACRO(LASTDEL)"
                                         
End

_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Tue Feb 21, 2006 9:11 am    Post subject: Reply with quote

acevedo wrote:
what about ?

[/code]


Good point
_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
acevedo
Beginner


Joined: 03 Dec 2002
Posts: 127
Topics: 0
Location: Europe

PostPosted: Wed Feb 22, 2006 2:30 am    Post subject: Reply with quote

oooooops it seems we both were posting at the same time...

Tue Feb 21, 2006 2:57 pm
Tue Feb 21, 2006 2:58 pm

and with the same idea too...

Wink
Back to top
View user's profile Send private message
aquarian
Beginner


Joined: 28 Sep 2005
Posts: 66
Topics: 17
Location: Mars

PostPosted: Thu Mar 02, 2006 2:39 am    Post subject: Reply with quote

Hi German,
Here is the REXX code
Code:

/*REXX*/                                 

/****************************************

 * SYSTEM : delete last 4 lines of a pds*

 * AUTHOR : BISWA                       *

 * PURPOSE: delete                      *

 ***************************************/

/*SAY "ENTER PDS"                       

PULL PDSNAME */                         

/*change the new pds name here*/         

NEWPDS=E11439.DEL.NEW                   

"EXECIO * DISKR INFILE (STEM FILE."     

"EXECIO 0 DISKR INFILE (FINIS"           

"FREE F(INFILE"                         

PDSNAME=STRIP(SUBSTR(FILE.1,1,44))       

RECV.=''                                 

F1=''                                   

F2=''                                   

F3=''                     

RTCODE = SYSDSN(NEWPDS)                               

IF RTCODE/='OK' THEN                                   

 DO                                                   

  "ALLOC DA('"NEWPDS"') F(DD1) NEW SPACE(20,20) DIR(5),

   DSORG(PO) TRACKS RECFM(F) LRECL(80) CATALOG"       

  "FREE F(DD1"                                         

 END                                                   

/***************************/                         

"ALLOC DA('"PDSNAME"') F(INDD) SHR REUSE"             

X=OUTTRAP(ARR.)                                       

"LISTDS '"PDSNAME"' MEMBER"                           

DO I =7 TO ARR.0                                       

   MEMNAME=PDSNAME||'('||STRIP(ARR.I)||')'             

   "ALLOC DA('"MEMNAME"') F(RECV) SHR REUSE"           

   "EXECIO * DISKR RECV(STEM RECV."                   

   "EXECIO 0 DISKR RECV(FINIS"                                     

   C = 0                                                           

   /*SEND.=''*/                                                     

   /* subtract the number depending on the no of lines to delete */

   DO J=1 TO RECV.0-4                                               

      C=C+1                                                         

      SEND.C=RECV.J                                                 

   END                                                             

   NEWMEM = NEWPDS||'('||STRIP(ARR.I)||')'                         

   "ALLOC DA('"NEWMEM"') F(MEM) SHR"                               

   "EXECIO * DISKW MEM (STEM SEND."                                 

   "EXECIO 0 DISKW MEM (FINIS"                                     

   "FREE F(MEM"                                                     

END                                                                 

EXIT

_________________
cheers,
Aquarian
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
German Castillo
Beginner


Joined: 23 Dec 2005
Posts: 83
Topics: 2
Location: Caracas, Venezuela

PostPosted: Thu Mar 02, 2006 7:23 am    Post subject: Reply with quote

Hi Aquarian

Your code might work, but it seems to be a little elaborated and time consuming, since you seem to be phisically READING each member into a stem var.

A better way to do it, is as explained above. I am going to sumarize it for your convenience, mixing it with your solution.

Make ONE Exec Rexx module and ONE Exec Macro Rexx Module. The idea is that from your exec module, you will have a list of Members in a PDS, then using the ISPEXEC EDIT service you will edit each individual member, using at the same time your Rexx Macro. The purpose of the macro is to get rid of the last 6 lines (This could aldo be another quantity, maybe in a parm). Remember to use IKJXXX to call this rexx, since you NEED to use ISPF in BATCH

Back to your rexx, It is OK to have the PDS Name inside a flat file, which you are reading, again you may extrapolate this solution for several datasets which names are contained in THAT flat file. Let's assume for now, that you have only One dataset name there. One word of cautions, LISTDS has the members starting in record 7, but theat MAY change in the future, I would let the rexx find the proper record by looking for the word "MEMBER" in the outtrapped cmd. Also, be sure to turn it off that outtrap once you are done with it, otherwise you will keep capturing comand outputs in your stem.

Your edit macro will be exactly as noted above, unless you want to get the numer of lines in a parm, I will leave thi modification for you.

The process should be quick and simple, open a PDS member, get tid of the n- last lines ans save it. Sometimes I have done similar task in 20000+ membres and it takes around 10 minutes at the most.

Last but not least, whenever possible, and if your code is quite long, please considere using code - /code tags, it makes easier to both look at the code and to copy/paste into ISPF if the case needs to.
_________________
Best wishes,

German Castillo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group