Reading contents of members inside a PDS

Hi Guys, I have PDS containing a large volume of JCL. I want to be able to read the contents of the mebmers to scan for certain values.

If is specify DCB=MYFILE.PDS,
DISP=OLD

Natural returns and error.

0100 NAT1502 PERMANENT PHYSICAL I/O ERROR FOR WORK FILE 1.

There is nothing with the PDS, I can browse or edit the members using File Aid, but there are over 6000 members.

Any ideas?

Hi Gerhard,
If - by any chance - your shop is using TSO,
https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistso.htm

the option 3.14 (Search-For Uitility) would be MUCH more appropriate to scan your PDS members for some value. I don`t think NATURAL is good for such a purpose.
Best of luck.

I am aware of that Utility, I was trying to create an automated process.

Thanks

I use TSO facilities for most PDS scans, but Natural’s MASK clause and EXAMINE statement are very powerful.

You cannot read PDS members sequentially by coding DSN=MYFILE.PDS. You can read a specific PDS member by coding DSN=MYFILE.PDS(member).

You can read a PDS directory (i.e. the list of members) only if Entire System Services is installed. Otherwise you will have to start with an IBM utility to create a sequential file of the member names .

I don’t have access to ESS, so here is a Natural program that reads a sequential file to get each member name and then reads the member. I tested it by running on-line under TSO.

DEFINE DATA LOCAL                                                    
1 #MEM (A44)  INIT <'MYFILE.PDS.MEMBER.LIST'>                              
1 #PDS (A44)  INIT <'MYFILE.PDS($MBRNAME$)'>                       
1 #LIST (A133)                                                       
1 #MEMBER (A8)                                                       
1 #SOURCE (A133)                                                     
1 #C (I4)                                                            
END-DEFINE                                                           
DEFINE WORK FILE 01 #MEM                                             
*                                                                    
READ WORK 01 #LIST               /* can be replaced with ESS commands
  RESET #MEMBER                                                      
  /* parse for member name                                           
  REJECT IF  #MEMBER = ' '                                           
  RESET INITIAL #PDS                                                 
  EXAMINE #PDS FOR '$MBRNAME$' REPLACE #MEMBER                       
  DEFINE WORK FILE 02 #PDS                                           
  ADD 1 TO #C                                                        
  READ WORK 02 #SOURCE                                               
    /* apply search criteria                                         
    WRITE (ES=T)                                                     
          #MEMBER (IS=T)                                             
          /* #SOURCE (AL=70)                                            
  END-WORK                                                           
END-WORK                                                             
WRITE / 'Members scanned:' #C (AD=L)                                 
END                                                                  

Thanks, that has given me an idea or two.

Much appreciated.