Joined: 30 Nov 2013 Posts: 886 Location: The Universe
JCL is not a programming language or a scripting language like Shell in Unix or Perl. It cannot loop, nor can it directly obtain and analyze data. It is simply a means to direct the system to run user programs and specify at least some of the data resources the programs require.
The first part of your task is to obtain the member names in the Partitioned Data Set. Joerg.Findeisen proposed using IEHLIST or LISTDS. Personally, I cannot recommend IEHLIST. It is simple to run in a batch environment, but its setup requirement in JCL is slightly complicated. LISTDS is a TSO line mode command. Unlike IEHLIST it requires a TSO environment to run, but its printed output is slightly easier for another program to process. Mr. Jensen suggested using ISPF SRCHFOR, but ISPF requires moderately complex JCL to prepare the environment for ISPF, so I so not think that is very viable. If PDS86 is already available in your environment it might be a viable alternative to LISTDS.
With the list of members, you can easily write a program to analyze the list. The program can be in any computer language you are comfortable using.
How about this approach ?
1. Use IEHLIST to get input Data Set with all Member names.
2. Sort the file from pos-4 till next 5 bytes.
3. Use this link to separate Duplicate vs unique. The unique Data set created is the one you are looking for.
Split a file into unique vs duplicate records