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 

Need a list of empty datasets from a saved list

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Nov 09, 2011 9:40 am    Post subject: Need a list of empty datasets from a saved list Reply with quote

Hi All,

I have a list of datasets which I have saved in 3.4 by SAVE LIST command.What I need is to find out all empty datasets from that list and store in a seperate dataset.I did try by using PRINT IDS COUNT(1) but it only checks for the first dataset.I did try using :
Code:

//DATA DD *
DATASET 1 NAME
DATASET 2 NAME
DATASET 3 NAME
DATASET 4 NAME
.
.
.
/*

I guess I am missing something here.Can somebody help me.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Nov 09, 2011 11:30 am    Post subject: Reply with quote

you have to have a separate ddname for each data set.
you concatenated the datasets (with means, treat all these as one)
and printed 1.
even if DS1 and DS2 were empty and DS3 had 1, you would have the same result as your test.

you have to have
//DAT1 DD dsn=DATASET 1 NAME
//DAT2 DD dsn=DATASET 2 NAME
//DAT3 DD dsn=DATASET 3 NAME
//DAT4 DD dsn=DATASET 4 NAME
//DAT5 DD dsn=DATASET 5 NAME
//DAT6 DD dsn=DATASET 6 NAME

and then REPRO commands for each.

but if you have only 1 sysout, then you need to parse the output.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Wed Nov 09, 2011 6:02 pm    Post subject: Reply with quote

Quick and dirty solution as a Rexx exec running in TSO:
Code:
/* Rexx - find empty sequential data sets in list of data sets        */
/*        created from ISPF 3.4 with SAVE NAMES command.              */
/*        That creates <prefix>.NAMES.DSNAMES data set.               */
/*        Assumes you have a TSO prefix.                              */
/*        Works because DS1LSTAR is 0 for empty sequential files.     */
/*        ISPF Browse uses the same trick, albeit more efficiently.   */
                                                                       
"ALLOC F(DSNAMES) DA(NAMES.DATASETS) SHR REUSE"                         
"EXECIO * DISKR DSNAMES (FINIS STEM DSN."                               
Do a = 1 to dsn.0                                                       
  Parse Upper Var dsn.a dsn.a .                                         
  Call listdsi "'"dsn.a"'"                                             
  If sysdsorg = "PS" Then                                               
    Do                                                                 
      Call outtrap trap.,"*","CONCAT"                                   
      "LISTDS '" || dsn.a || "' LABEL"                                 
      Call outtrap "OFF"                                               
      If trap.6 = "--FORMAT 1 DSCB--" Then                             
        Do                                                             
          If 0 = word(trap.8,11) Then                                   
            Say dsn.a                                                   
        End                                                             
    End                                                                 
End                                                                     
"FREE  F(DSNAMES)"

In the interest of completeness, I should note that this also will flag data sets that are open but not yet written to, but other methods would probably do the same (or might fail if a data set was open elsewhere).

(Whoo that felt good to write a stupid little piece of code. It's been a while.)
_________________
New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html.
Back to top
View user's profile Send private message Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Nov 10, 2011 4:51 am    Post subject: Reply with quote

Thanks Dick and Semigeezer,

My saved list is in dataset TEST.LIST.DATASETS. A small clarification , in the Rexx code , the way I have included the name after DA , is it correct.Now what my understanding is after I execute the REXX code , will the list of empty datasets get stored in TEST.NAMES.DSNAMES assuming TEST is my TSO ID.
Code:

"ALLOC F(DSNAMES) DA('TEST.LIST.DATASETS') SHR REUSE"   

I am trying to execute :
Code:

EDIT              TEST.REXX.PDS                             Row 00001 of 00001
Command ===>                                                  Scroll ===> CSR 
           Name     Prompt       Size   Created          Changed          ID   
EX_______ EMPTY                    25  1992/11/23  2011/11/10 01:29:36  TEST
Back to top
View user's profile Send private message
John_Deal
Beginner


Joined: 04 Sep 2003
Posts: 15
Topics: 1

PostPosted: Thu Nov 10, 2011 9:25 am    Post subject: Reply with quote

Why don't you use the %used column on 3.4 to see which ones are empty? Seems lots easier to me... Question

P.S. You'll have to 'recall' any migrated datasets (but you'll have to do that with any other method as well)...

8)
_________________
Life is a journey; enjoy the trip!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Thu Nov 10, 2011 12:27 pm    Post subject: Reply with quote

John_Deal wrote:
Why don't you use the %used column on 3.4 to see which ones are empty? Seems lots easier to me... Question
8)


I Would go with John's suggestion and %Used column starts from pos 89 for 3 bytes.
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Thu Nov 10, 2011 9:54 pm    Post subject: Reply with quote

Thanks Kolusu and John , that works much better solution.
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 -> Job Control Language(JCL) 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