IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extract certain output from LISTDS


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Fri Jan 04, 2008 6:11 pm
Reply with quote

Hi Experts!

I need to extract the library and the list of members from the LISTDS TSO-utility.

The JCL:
Code:
//LISTDS  EXEC PGM=IKJEFT01                 
//SYSTSPRT DD DSN=outputdsn,       
//            DISP=(NEW,CATLG,CATLG),       
//            SPACE=(CYL,(15,5),RLSE)       
//SYSTSIN  DD *                             
  LISTDS 'lib1' MEMBERS   
  LISTDS 'lib2' MEMBERS

Output from LISTDS (RECFM=VBA, LRECL=137):
Code:

READY                                   
  LISTDS 'lib1' MEMBERS
lib1
--RECFM-LRECL-BLKSIZE-DSORG             
  FB    80    32720   PO               
--VOLUMES--                             
  list of volumes                               
--MEMBERS--                             
  list of members
READY                                   
  LISTDS 'lib2' MEMBERS
lib2
--RECFM-LRECL-BLKSIZE-DSORG             
  FB    80    32720   PO               
--VOLUMES--                             
  list of volumes                               
--MEMBERS--                             
  list of members
READY
END

My output should be:
lib1 member1
lib1 member2
...
lib1 membern
lib2 member1
lib2 member2
...
lib2 membern

1-n libraries can be present. How to do that? Please help... icon_biggrin.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jan 04, 2008 10:40 pm
Reply with quote

The following DFSORT/ICETOOL JCl will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                         
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//IN       DD DSN=YOUR VBA LISTDS DATASET,DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)           
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                     
  COPY FROM(IN) USING(CTL1)                                         
  SPLICE FROM(T1) TO(OUT) WITHALL ON(55,8,CH) WITH(45,10) USING(CTL2)
//CTL1CNTL DD *                                                     
  INREC IFTHEN=(WHEN=INIT,                                           
      OVERLAY=(138:SEQNUM,8,ZD,155:6,44)),                 
        IFTHEN=(WHEN=(157,6,CH,EQ,C'LISTDS'),                       
       OVERLAY=(138:SEQNUM,8,ZD)),                                   
        IFTHEN=(WHEN=NONE,                                           
       OVERLAY=(146:SEQNUM,8,ZD,                                     
                138:138,8,ZD,SUB,146,8,ZD,M11,LENGTH=8))             
  OUTREC IFTHEN=(WHEN=INIT,                                         
          BUILD=(1,4,155,44,138,8,SEQNUM,8,ZD,RESTART=(138,8)))     
                                                                     
  OUTFIL FNAMES=T1,VTOF,BUILD=(5,60,80:X)                           
//CTL2CNTL DD *                                                     
  SORT FIELDS=COPY                                                   
  OMIT COND=(01,5,CH,EQ,C'READY',OR,                                 
             01,3,CH,EQ,C'END',OR,                                   
             53,8,ZD,EQ,1,OR,                                       
            (53,8,ZD,GT,2,AND,53,8,ZD,LT,8))                         
  INREC IFTHEN=(WHEN=INIT,                                           
        BUILD=(01,44,55:45,16)),                                     
        IFTHEN=(WHEN=(63,8,ZD,NE,2),                                 
        BUILD=(44X,2,10,55,16))   

  OUTFIL FNAMES=OUT,BUILD=(01,54,SQZ=(SHIFT=LEFT,MID=C' '),80:X)
/*                             
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Sat Jan 05, 2008 4:05 pm
Reply with quote

I got the SEQNUM part idea right, but couldn't figure it out for multiple libraries... Amazing stuff, can't wait to try it out on Tuesday! Thanks a lot! icon_smile.gif
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Sat Jan 05, 2008 4:06 pm
Reply with quote

By the way... what's the idea with SORT FIELDS=COPY for the SPLICE operator?
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Sat Jan 05, 2008 5:46 pm
Reply with quote

Claes Norreen,
Quote:
what's the idea with SORT FIELDS=COPY for the SPLICE operator?

Its not required. You can omit it.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Jan 05, 2008 10:35 pm
Reply with quote

Quote:
By the way... what's the idea with SORT FIELDS=COPY for the SPLICE operator?


Quote:
Its not required. You can omit it.


No, you shouldn't omit it. Kolusu used the SORT FIELDS=COPY for SPLICE to have it do a copy instead of a sort. Copy is more efficient than sort. In this case since the group numbers he has in positions 55-62 for the SPLICE are already in order (the records in the first group have 00000001, the records in the second group have 00000002, etc), he cleverly realized that he could do a copy rather than a sort.

(Kolusu is on vacation, so I responded for him.)
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Tue Jan 08, 2008 12:53 pm
Reply with quote

I tried it out, and it works nicely! But I wonder about a couple of things:

1) You assume the memberlist always starts in line 8. This is only true, if the list of volumes consist of only 1 entry. I'm uncertain whether this is true or not..? I would think you'd need to scan for the "--MEMBERS--" record..?
2) What's the idea/effect of the ON(55,8,CH) and WITH(45,10) for the SPLICE operator, when the sequence numbers are in position 45,8 and 53,8?
3) What's the idea of copying the input to the end of each record?

Thank you for your time! icon_biggrin.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jan 08, 2008 10:11 pm
Reply with quote

Kolusu should be the one to respond to your questions, but as I said, he's on vacation this week. I'm sure he'll respond when he gets back.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jan 10, 2008 1:35 am
Reply with quote

Quote:

1) You assume the memberlist always starts in line 8. This is only true, if the list of volumes consist of only 1 entry. I'm uncertain whether this is true or not..? I would think you'd need to scan for the "--MEMBERS--" record..?


I have tried with multi volume (3 volumes) and it wrote out the volumes on a sinlge line. So the member line does start in line 8. If you find discrepency then we can change it
Quote:

2) What's the idea/effect of the ON(55,8,CH) and WITH(45,10) for the SPLICE operator, when
the sequence numbers are in position 45,8 and 53,8?


In pos 45 we have the member names and PDS name is in the first 44 bytes. The seqnum is in pos 55 for 8 bytes. So we are splicing the PDS name with every member name which is in pos 45.

Quote:

3) What's the idea of copying the input to the end of each record?


The output of LISTDS is VBA and some of the records are short. So I padded the actual contents at the end of each record so that it is easy to omit the unwanted records. I Initally pad the contents using inrec and when I am actually writing out , I create a 80 byte FB file.

Hope this helps...

Cheers
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Jan 10, 2008 2:49 am
Reply with quote

It does help - thanks again! icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts XDC SDSF output to temp dataset CLIST & REXX 4
Search our Forums:

Back to Top