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...
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!
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
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.
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?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
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.