z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Reading a PDS Directory Sequentially

z/OS DFSMS Using Data Sets
SC23-6855-00

You can read a PDS directory sequentially just by opening the data set to its beginning (without using positioning macros) and reading it.
  • The DD statement must identify the DSNAME without a member name.
  • You can use either BSAM or QSAM with MACRF=R or G.
  • Specify BLKSIZE=256 and RECFM=F or RECFM=U.
  • QSAM always requires LRECL=256
  • You should test for the last directory entry (8 bytes of X'FF'). Records and blocks after that point are unpredictable. After reading the last allocated directory block, control passes to your EODAD routine or reading continues with a concatenated data set. You can issue an FEOV macro to cease reading the current data set and continue with the next one. If you issue FEOV while reading the last or only data set, control passes to your EODAD routine.
  • If you also want to read the keys (the name of the last member in that block), use BSAM and specify KEYLEN=8.

This technique works when PDSs and PDSEs are concatenated. However, you cannot use this technique to sequentially read a UNIX directory. The system considers this to be a like sequential concatenation. See Reading a PDSE Directory.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014