View previous topic :: View next topic |
Author |
Message |
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Wed Nov 09, 2011 9:40 am Post subject: Need a list of empty datasets from a saved list |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Wed Nov 09, 2011 11:30 am Post subject: |
|
|
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 |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Wed Nov 09, 2011 6:02 pm Post subject: |
|
|
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 |
|
|
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Thu Nov 10, 2011 4:51 am Post subject: |
|
|
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 |
|
|
John_Deal Beginner
Joined: 04 Sep 2003 Posts: 15 Topics: 1
|
Posted: Thu Nov 10, 2011 9:25 am Post subject: |
|
|
Why don't you use the %used column on 3.4 to see which ones are empty? Seems lots easier to me...
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Nov 10, 2011 12:27 pm Post subject: |
|
|
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...
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 |
|
|
yadav2005 Intermediate
Joined: 10 Jan 2005 Posts: 348 Topics: 144
|
Posted: Thu Nov 10, 2011 9:54 pm Post subject: |
|
|
Thanks Kolusu and John , that works much better solution. |
|
Back to top |
|
|
|
|