# Reading contents of members inside a PDS

**URL:** <https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [December 12, 2019, 1:57pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452 "2019-12-12T13:57:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gerhard\_van\_Aswegen](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Gerhard\_van\_Aswegen](https://techcommunity.softwareag.com/u/Gerhard_van_Aswegen)\
**Post date:** [December 12, 2019, 1:57pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/1 "2019-12-12T13:57:37Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Nikolay\_Kuhta](https://avatars.discourse-cdn.com/v4/letter/n/35a633/32.png) [@Nikolay\_Kuhta](https://techcommunity.softwareag.com/u/Nikolay_Kuhta)\
**Post date:** [December 12, 2019, 2:39pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/2 "2019-12-12T14:39:37Z")

</div>

Hi Gerhard,  
If - by any chance - your shop is using TSO,

> **[What is TSO?](https://www.ibm.com/docs/en/zos-basic-skills?topic=interfaces-what-is-tso)**
>
> Time Sharing Option/Extensions (TSO/E) allows users to create an interactive session with the z/OS system. TSO provides a single-user logon capability and a basic command prompt interface to z/OS.

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.

---

<div class="post-metadata">

**Author:** ![Gerhard\_van\_Aswegen](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Gerhard\_van\_Aswegen](https://techcommunity.softwareag.com/u/Gerhard_van_Aswegen)\
**Post date:** [December 12, 2019, 2:45pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/3 "2019-12-12T14:45:09Z")

</div>

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

Thanks

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [December 12, 2019, 5:40pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/4 "2019-12-12T17:40:46Z")

</div>

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.

```auto
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                                                                  
```

---

<div class="post-metadata">

**Author:** ![Gerhard\_van\_Aswegen](https://avatars.discourse-cdn.com/v4/letter/g/4af34b/32.png) [@Gerhard\_van\_Aswegen](https://techcommunity.softwareag.com/u/Gerhard_van_Aswegen)\
**Post date:** [December 13, 2019, 7:04am UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/5 "2019-12-13T07:04:29Z")

</div>

Thanks, that has given me an idea or two.

Much appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:43pm UTC](https://techcommunity.softwareag.com/t/reading-contents-of-members-inside-a-pds/206452/6 "2021-04-02T15:43:57Z")

</div>


