View previous topic :: View next topic |
Author |
Message |
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Mon Sep 21, 2009 5:39 am Post subject: GDG oldest generation deletion using rexx |
|
|
Hi,
I need to read a FILE-A having a list of GDG base and to delete the oldest generation of this GDG files using rexx code.
I.E
---
FILE-A has below records
USER1.TESTA.GDG1
USER1.TESTB.GDG2
USER1.TESTC.GDG3
Now i need to read this file-A and to delete the oldest generation of all the three GDG files using rexx code. Generations of each files is not uniform.
I am learning rexx now, somehow I tried to formulate the below code to display the oldest generation indivdually.
-------------
/* REXX */
X = OUTTRAP(S.)
"LISTCAT ENT('USER1.TESTA.GDG1') ALL"
SAY S.9
EXIT
-------------
But not sure how to put all the below three requirements in single rexx program
1. Reading the ps file, to read all the GDG base files
2. Listing the oldest generation of each GDG
3. Deleting the oldest generation of each file.
Thanks. |
|
Back to top |
|
|
s_shivaraj Beginner
Joined: 21 Sep 2004 Posts: 140 Topics: 14 Location: Chennai, India
|
Posted: Mon Sep 21, 2009 6:01 am Post subject: |
|
|
Try this and let me know ..
Code: | /* rExx */
ListDataset = 'userid.dataset.list'
"alloc f(inpdd) da('"ListDataset"') shr reuse" ;
"execio * diskr inpdd (stem FileArray. finis" ;
"free f(inpdd)" ;
Do TempCount = 1 to FileArray.0
parse var FileArray.Tempcount gdg_base Junk
x = outtrap('l.')
address TSO "LISTC ENT('"gdg_base"')"
x = outtrap("OFF")
File = word(translate(l.3,' ','-'),2)
DELETE File
End ; |
_________________ Cheers
Sivaraj S
'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity' |
|
Back to top |
|
|
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Mon Sep 21, 2009 6:32 am Post subject: |
|
|
Shiva,
Thanks for the prompt response, can you please explain the highlevel logic behind this code as instead of executing it blindly i would learn few things and able to fix/modify it, if its neccessary. |
|
Back to top |
|
|
s_shivaraj Beginner
Joined: 21 Sep 2004 Posts: 140 Topics: 14 Location: Chennai, India
|
Posted: Mon Sep 21, 2009 6:46 am Post subject: |
|
|
sanjayr321
Below piece of code is to read the list of names from the input file Code: | ListDataset = 'userid.dataset.list'
"alloc f(inpdd) da('"ListDataset"') shr reuse" ;
"execio * diskr inpdd (stem FileArray. finis" ;
"free f(inpdd)" ;], |
Once you get the full list, loop through them, below piece of code will do the looping and
Code: | Do TempCount = 1 to FileArray.0
parse var FileArray.Tempcount gdg_base Junk
x = outtrap('l.')
address TSO "LISTC ENT('"gdg_base"')"
x = outtrap("OFF") |
Code: | address TSO "LISTC ENT('"gdg_base"')" | is used to display the details of the GDG _________________ Cheers
Sivaraj S
'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity' |
|
Back to top |
|
|
s_shivaraj Beginner
Joined: 21 Sep 2004 Posts: 140 Topics: 14 Location: Chennai, India
|
Posted: Mon Sep 21, 2009 6:49 am Post subject: |
|
|
3rd line in the array had the name of the first version, hence the reference
Code: | File = word(translate(l.3,' ','-'),2) |
Translate will replace the '-' with a Space.
Once we get the first version, we are deleting using the below code
_________________ Cheers
Sivaraj S
'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity' |
|
Back to top |
|
|
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Mon Sep 21, 2009 8:46 am Post subject: |
|
|
Shiva,
Its perfect, processing correctly but while executing it failed with maxcc=8 IDC3902I as the GDG version adding my user id as prefix extra. i.e file name is changing to USERID1.USERID1.TESTA.GDG.G0001V00 and its failing with file not found.
Is there any command to supress the first USERID. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Mon Sep 21, 2009 1:28 pm Post subject: |
|
|
sanjayr321,
add this line at the beginning of your rexx exec right after /* rExx */ statement
Code: |
ADDRESS TSO "PROFILE NOPREFIX"
|
_________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Tue Sep 22, 2009 1:19 am Post subject: |
|
|
Dare I ask why you need to delete the oldest generation manually ? _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
|
sanjayr321 Beginner
Joined: 25 Sep 2006 Posts: 28 Topics: 15
|
Posted: Tue Sep 22, 2009 11:31 pm Post subject: |
|
|
Its working perfectly, many thanks Shiva and Kolusu for the help provided... |
|
Back to top |
|
|
|
|