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 

GDG oldest generation deletion using rexx

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Mon Sep 21, 2009 5:39 am    Post subject: GDG oldest generation deletion using rexx Reply with quote

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
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Mon Sep 21, 2009 6:01 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Mon Sep 21, 2009 6:32 am    Post subject: Reply with quote

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
View user's profile Send private message
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Mon Sep 21, 2009 6:46 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
s_shivaraj
Beginner


Joined: 21 Sep 2004
Posts: 140
Topics: 14
Location: Chennai, India

PostPosted: Mon Sep 21, 2009 6:49 am    Post subject: Reply with quote

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
Code:
DELETE File 

_________________
Cheers
Sivaraj S

'Technical Skill is the Master of complexity, while Creativity is the Master of Simplicity'
Back to top
View user's profile Send private message AIM Address
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Mon Sep 21, 2009 8:46 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Mon Sep 21, 2009 1:28 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Tue Sep 22, 2009 1:19 am    Post subject: Reply with quote

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
View user's profile Send private message
sanjayr321
Beginner


Joined: 25 Sep 2006
Posts: 28
Topics: 15

PostPosted: Tue Sep 22, 2009 11:31 pm    Post subject: Reply with quote

Its working perfectly, many thanks Shiva and Kolusu for the help provided...
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 -> TSO and ISPF 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