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)
DEFINE WORK FILE 01 #MEM
READ WORK 01 #LIST /* can be replaced with ESS commands
/* 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
/* #SOURCE (AL=70)
WRITE / 'Members scanned:' #C (AD=L)