REXX:How to list datasets created by an USERID into a file



IBM's Command List programming language & Restructured Extended Executor

REXX:How to list datasets created by an USERID into a file

Postby kamal » Mon Jul 21, 2008 11:02 am

How to list all the datasets created by an USERID into a flat file(80 FB) using REXX.

Thanks!
kamal
 
Posts: 48
Joined: Wed Aug 22, 2007 2:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a file

Postby kamal » Mon Jul 21, 2008 2:54 pm

Hmm..was trying from morning ...finally found this code on one of the forums
/*REXX*/                                                         
DSNAME =""USERID""."*"                                         
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DSNAME)"                     
cnt=1                                                           
DO FOREVER                                                       
   "ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSNAME) "
   IF RC = 0 THEN                                               
    DO                                                           
/* SAY "'"DSNAME"'"*/                                           
     DSNAME1 ="'"DSNAME"'"                                       
     y = LISTDSI(DSNAME1 directory)                             
     SAY DSNAME SYSCREATE SYSREFDATE                             
     DATA.CNT = DSNAME SYSCREATE SYSREFDATE                     
     CNT = CNT + 1                                               
    END                                                         
   ELSE LEAVE                                                   
END                                                             
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"   
"ALLOC FI(OUT) NEW RECFM(F B A) LRECL(80)",                   
"BLKSIZE(0) SPACE(5,5)  TR",                                   
"DA(DELETE.ME2)"                                               
'EXECIO * DISKW  OUT (STEM DATA. FINIS'   /* copy using stem*/
"FREE F(OUT)"                                                 

 


It's working;I added creation and reference date(s) too.

Now am facing another problem as:
When I say
y = LISTDSI(DSNAME1 directory)   

It recalls the migrated datasets and DASD is unnecessary occupied...
Is there any way by which we can get the creation/reference date without recalling the datasets?
Guess no..but then can we remigrate the recalled datsets?
Please share the code or suggest any other way to accomplish it.
kamal
 
Posts: 48
Joined: Wed Aug 22, 2007 2:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a file

Postby dick scherrer » Mon Jul 21, 2008 10:06 pm

Hello,

So far, i've supported several hundred mainframes. None has ever had the requirement to determine the creating userid. This is somehthing often done in a Win-based environment (and sometimes unix) but not the mainframe. On the mainframe nearly everything is managed/controlled by high-level quelifier (hlq) and there is not much value in the creating userid (most datasets are actually not created by some user).

To recall all of the migrated datasets to merely get the creating userid is a major waste of system resources. To re-migrate them is yet another waste. You might simply "skip" any that are migrated. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REXX:How to list datasets created by an USERID into a file

Postby kamal » Wed Jul 23, 2008 12:49 pm

On the mainframe nearly everything is managed/controlled by high-level quelifier (hlq)

Must be true..and here in our shop HLQ is always a creator's USERID.
We can create datasets with name starting with USERID as HLQ only.
Sorry for the confusion

Actually I wanted to list all the datasets with particular HLQ ,which are not being used in near time.
For that I took date of last refernce into consideration and if the lr date is less than 2 months or more to current date then will list those datsets.These datsets could be on DASD,TAPE or migrated.
If anybody could suggest way to accomplish it; would be a great help!!

Hope I have put requirement properly.
kamal
 
Posts: 48
Joined: Wed Aug 22, 2007 2:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a file

Postby Bill Dennis » Thu Jul 24, 2008 2:32 am

Do you really need the DIRECTORY option just to get your dates? That may be causing the recall.

You can also say NORECALL on LISTDSI and take an error for migrated files.
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a file

Postby dick scherrer » Thu Jul 24, 2008 2:34 am

Hello,

We can create datasets with name starting with USERID as HLQ only.
I suspect this is the rule for datasets created by developers. I also suspect that the production libraries, vsam files, database datasets do not use some personal userid as the hlq. . . But that will not help get what you need ;)

To find out everyting that has happened to datasets (regardless of media), you could find all dataset references in the smf data.

If you talk with your storage management people, they may already have something that will meet your requirement that reports against the smf data.

Given that much of the data you want to monitor is migrated, there may be some info created by sms that would help. Again the storage management people would be knowledgable if such info is already available on your system.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REXX:How to list datasets created by an USERID into a file

Postby kamal » Mon Jul 28, 2008 3:06 pm

Dick, I am thinking on points you told...actually it's not possible for us to reach storage people easily.So as of now am taking Bill Dennis' suggestions ...'norecall' option works!
Thanks a lot both of you!!
kamal
 
Posts: 48
Joined: Wed Aug 22, 2007 2:49 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a fi

Postby balamurali cl » Wed Sep 05, 2012 7:01 pm

Hi Kamal,

I als doing the same work now.

I have written a REXX program where I liat all the files created by a user and Now I want to get the last refernced date of all the datasets and if the last refernced date is 365 days ago, I am trying to list It...Here all the datasets are geeting recalled and hense refernced date is shown as todays.

I used the NORECALL option and for that the dataset is not recalled but the RC is 16.

But with that I cant tell that the Dataset is 365 days ago refernced.

Please let me know how you accomplished the task ..please help me...it will help a lot
balamurali cl
 
Posts: 36
Joined: Mon Sep 03, 2012 9:01 pm
Has thanked: 2 times
Been thanked: 0 time

Re: REXX:How to list datasets created by an USERID into a fi

Postby dick scherrer » Wed Sep 05, 2012 7:32 pm

Hello,

You can recall all of them or you can skip over the migrated datasets. . .

If they are migrated, and the "owner" has not deleted them, suggest you do not delete them either. . . Many valuable files are not "touched" for a year or more and the cost of having them archived is nothing compared to the grief if they are deleted and needed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: REXX:How to list datasets created by an USERID into a fi

Postby Akatsukami » Wed Sep 05, 2012 7:39 pm

dick scherrer wrote:Many valuable files are not "touched" for a year or more

The same is true of many threads :mrgreen:
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post