Joined: 28 Sep 2005 Posts: 66 Topics: 17 Location: Mars
Posted: Tue Feb 21, 2006 1:46 am Post subject: Need a JCL te delete last 6 lines from all PDS members
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
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:
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,
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