View previous topic :: View next topic
|
Author |
Message |
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
Hi,
I want a JCL code which can delete selective number of versions from one GDG.. Let me give you the details below .
suppose i have
Example.gdg1(1)
Example.gdg1(2)
Example.gdg1(3)
Example.gdg1(4)
Example.gdg1(5)
i need to delete the first 3 alone
i will appreciate if anyone can give me Idea on how shall I go about it.
Regds,
useit |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
First of all suspect you need to delete specific generations and not VERSIONS... Get your basics correct..
Now coming to your problem..
What decides the specific generations to be deleted? is it always oldest three? |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
escapa,
it is always oldest three
Regds,
useit |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
useit wrote: |
escapa,
it is always oldest three
Regds,
useit |
What you are going to achieve by that?
If you don't need oldest three why not just reduce the limit by three? What is the reason you don't want to do that...?
And finally at all If you really want to do .. REXX could be one of the better candicate ... |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
sorry not the oldest three..the limit is 5. and the generation can vary..
am reading gdg base.so which will read all the versions. after processing this i jus have to delete only the generations which was processed in the previous step.(read in the previous step)
because. while deleting some other job ll create a new versions which should not get deleted. so i cant delete all the generations of the gdg.i
should delete only the generations which was processed in the previous step.
i would be really thankful to you if you could help in this regard. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
This could be one more way...
Use IDCAMS and list all generations
Parse ouput to create tso delete command
Execute those commands
Code: |
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD DSN=&&TEMP,DISP=(NEW,PASS)
//SYSIN DD *
LISTCAT LVL(gdgbasefilename) ALL GDG
/*
//STEP02 EXEC PGM=SORT
//SORTIN DD DSN=&&TEMP,DISP=(MOD,PASS)
//SORTOUT DD DSN=&&TEMP1,DISP=(NEW,PASS),RECFM=FB,LRECL=80
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,VLSCMP
INCLUDE COND=(13,7,CH,EQ,C'NONVSAM')
INREC OVERLAY=(5:C'DEL ''',22,44,C'''')
OUTFIL VTOF,BUILD=(5:5,4,9:9,46,SQZ=(SHIFT=LEFT),80:X),ENDREC=3
//STEP03 EXEC PGM=IKJEFT01
//SYSPRINT DD SYSOUT=*
//SYSTERM DD SYSOUT=*
//SYSTSIN DD DSN=&&TEMP1,DISP=(MOD,PASS)
//SYSTSPRT DD SYSOUT=*
|
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
sounds like: could not fix the brakes, so I made the horner louder.
useit,
the first thing you should do is understand gdg's,
how they work, and why to implement them.
you still have not answered: Why do you think it is necessary to delete these older generations?
there are several ways one can go about deleting files / creating delete parameters,
but why the need? |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
am reading gdg base.so which will read all the versions. after processing this i jus have to delete only the generations which was processed in the previous step.(read in the previous step)
|
I am assuming that you mean generations not versions above. These words are NOT interchangable.
Anyway, when you read the GDG Base, use a DISP=(OLD,DELETE,KEEP).
The OLD will ensure no one else is using the GDG. The DELETE will delete all GENERATIONS upon succcessful completion. The KEEP will the data in the event of an abend.
No extra step is required. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Not to cause additional work for the moderators, but why is this thread in the DFSORT/ICETOOL forum instead of the JCL or the SMS & VSAM forum? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Akatsukami wrote: |
Not to cause additional work for the moderators, but why is this thread in the DFSORT/ICETOOL forum instead of the JCL or the SMS & VSAM forum?
|
because to start it seemed that the TS wanted something to generate the "proper" control cards.
after a while, it became obvious that this thread belonged in the
REALLY SILLY REQUIREMENTS forum,
one of which we do not have. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
what happens when the job fails and a new GDG is created by SOME OTHER job ?
How does the job know which GDG's to process ?
I can see many flaws with this process.
Quote: |
The OLD will ensure no one else is using the GDG. The DELETE will delete all GENERATIONS upon succcessful completion |
A non zero return code will also delete all the GDG's'
So DISP=(OLD,DELETE,KEEP) has it's issues.
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
should delete only the generations which was processed in the previous step. |
No, it should NOT. . .
If this is transient data, there is no reason to use a gdg.
I don't know if the person that made this a requirement is without a clue or was trying to show off somethng that no wellrun system would tolerate.
It simply will not work. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I can not speak for the the TS's requirement, but I use this technique alot.
Scenario:
We have a daily job that tracks trasmissions to a daily log file (GDG).
At the end of the week, a weekly Job (syncsort) rolls up all the generations onto a weekly log file (different GDG). We use the daily base gdg to get all the generations, and delete them all with the disp=(old,delete,keep). we also have a yearly job to roll up all the weekly files onto a single yearly tape (gdg).
Scenario:
Several Jobs can run in a very short time each writing a few records to a new generation to the same gdg. Each of these jobs will trigger another Job (Job B) to process the data. The first occurance of Job B will process all generations (using gdg base) then delete all the generations disp=(old,delete,keep).
So there are reasons to use this technique in our world. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
dave,
you are talking about rolling all the gdg's from one base to a new gdg in a second base.
What you described in basic gdg processing.
the TS is talking about deleting the oldest 3 (2?) gdg's in a base.
he is not saving anything, except toilet paper. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Dick,
In is second description he says:
Quote: |
am reading gdg base.so which will read all the versions. after processing this i jus have to delete only the generations which was processed in the previous step.(read in the previous step)
|
This means the same to me as what I described. If he has disp=(old,delete.keep). Those will be deleted.
he later says:
Quote: |
because. while deleting some other job ll create a new versions which should not get deleted. so i cant delete all the generations of the gdg. |
If he has disp=(old,delete.keep) then the 'other job' will not be able to add any generations until this job is finished with the gdg. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Dave,
Quote: |
This means the same to me as what I described. |
I have a different understanding. . . What you posted is the way i've seen this done for a long time.
Quote: |
i jus have to delete only the generations which was processed in the previous step.(read in the previous step) |
I've not yet seen where someone was trying to selectively delete genertions "on the fly" while other generatoins are being created. . . |
|
Back to top |
|
|
seagull
New User
Joined: 28 May 2007 Posts: 24 Location: Dublin
|
|
|
|
It sounds like there is also a lack of understanding about how to use a scheduler. It's quite simple to make the job that uses and deletes the GDG and the job(s) that create generations mutually exclusive. That way, there's no need to piss about trying to determine which generations have just been processed. You can just delete everything that's there. |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi All,
Thanks for the overwhelming response to the query posted .I would like to thank everyone whoever tried providing a solution and helped me coming up with feasible solution for my requirement.
Regds,
useit. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
useit wrote: |
hi All,
Thanks for the overwhelming response to the query posted .I would like to thank everyone whoever tried providing a solution and helped me coming up with feasible solution for my requirement.
Regds,
useit. |
Do post back your final solution..
It might help others.... |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi,
sorry for bothering again.i have a query
LISTCAT LVL will list all the genearations of gdg. can we extract and concatinate those generations in the next step?.
for example.
say STEP 1 LISTCAT LVL Will list below 3 generations.
GDG(1)
GDG(2)
GDG(3)
step 2:
I Just have to concatinate these generations in this step.
say sortin DD DSN=GDG(1)
DD DSN=GDG(2)
DD DSN=GDG(3)
i know reading the base would read All the generations. but there is a chances of some other generation getting created in between.(which i want to prcess in the next run only)
let me know if this is possible?
Regds,
useit |
|
Back to top |
|
|
seagull
New User
Joined: 28 May 2007 Posts: 24 Location: Dublin
|
|
|
|
Your best option is to use a scheduler to prevent more generations being created while this job is processing. |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
hi,
escapa's solution worked for me.
Ø Use IDCAMS and list all generations
Ø Parse output to create TSO delete command
Ø Execute those commands
Regds,
use it |
|
Back to top |
|
|
useit
Active User
Joined: 05 Oct 2006 Posts: 152
|
|
|
|
seagull,
there is no direct dependency b/w different runs of jobs.
it was a real challenge to properly place the mutual dependencies.
And in case we had gone ahead with the approach of placing mutual dependencies then, it would really have been a messy approach complicating our schedule
Regds,
useit |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
Quote: |
i know reading the base would read All the generations. but there is a chances of some other generation getting created in between.(which i want to prcess in the next run only)
|
This is not true.
If this Job uses DISP=(OLD,DELETE,KEEP) on the GDG base and the 'other' Job has DISP=(NEW,CATLG,DELETE) on the +1, then it is not possible to create 'some other generation'.
The first Job in gets control of the entire structure, and the other job will get a waiting for datasets message.
No scheduling required, no listcats and deletes, just clean and simple jcl.
Why do I bother? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Dave,
'Cause you can. . .
Sometimes we actually do get thru to folks who have made something much more difficult that it needs to be. |
|
Back to top |
|
|
|