Regular and extended partitioned data sets

Partitioned data sets (PDS) and partitioned data sets extended (PDSE) are DASD data sets divided into sections known as members. Each member can be accessed individually by its unique 1- to 8-character name. As Table 1 shows, PDSEs are similar to PDSs, but contain a number of enhancements.

Table 1. PDSE and PDS differences
PDSE Characteristics PDS Characteristics
Data set has a 123-extent limit Data set has a 16-extent limit
Directory is open-ended and indexed by member name; faster to search directory Fixed-size directory is searched sequentially
PDSEs are device-independent: records are reblockable Block sizes are device-dependent
Uses dynamic space allocation and reclamation Must use IEBCOPY COMPRESS to reclaim space
Supports creation of more than one member at a time* Supports creation of only one member at a time
Note: *z/OS® XL C/C++ allows you to open two separate members of a PDSE for writing at the same time. However, you cannot open a single member for writing more than once.
You specify a member by enclosing its name in parentheses and placing it after the data set name. For example, the following JCL refers to member A of the data set MY.DATA:
   //MYDD   DD DSN=userid.MY.DATA(A),DISP=SHR
You can specify members on calls to fopen() and freopen(). You can specify members when you are opening a data set by its data set name or by a ddname. When you use a ddname and a member name, the definition of the ddname must not also specify a member. For example, using the DD statement above, the following will fail:
   fp = fopen("dd:MYDD(B)","r");

You cannot open a PDS or PDSE member using the modes a, ab, a+, a+b, w+, w+b, or wb+. If you want to perform the equivalent of the w+ or wb+ mode, you must first open the file as w or wb, write to it, and then close it. Then you can perform updates by reopening the file in r+ or rb+ mode. You can use the C library functions ftell() or fgetpos() to obtain file positions for later updates to the member. Normally, opening a file in r+ or rb+ mode enables you to extend a file by writing to the end; however, with these modes you cannot extend a member. To do so, you must copy the contents of the old member plus any extensions to a new member. You can remove the old member by using the remove() function and then rename the new member to the old name by using rename().

All members have identical attributes for RECFM, LRECL, and BLKSIZE. For PDSs, you cannot add a member with different attributes or specify a RECFM of FBS, FBSA, or FBSM. z/OS XL C/C++ verifies any attributes you specify.

For PDSEs, z/OS XL C/C++ checks to make sure that any attributes you specify are compatible with those of the existing data set. Compatible attributes are those that specify the same record format (F, V, or U) and the same LRECL. Compatibility of attributes enables you to choose whether to specify blocked or unblocked format, because PDSEs reblock all the records. For example, you can create a PDSE as FB LRECL=40 BLKSIZE=80, and later open it for read as FB LRECL=40 BLKSIZE=1600 or F LRECL=40 BLKSIZE=40. The LRECL cannot change, and the BLKSIZE must be compatible with the RECFM and LRECL. Also, you cannot change the basic format of the PDSE from F to V or vice versa. If the PDS or PDSE already exists, you do not need to specify any attributes, because z/OS XL C/C++ uses the previously existing ones as its defaults.

At the start of each partitioned data set is its directory, a series of records that contain the member names and starting locations for each member within the data set. You can access the directory by specifying the PDS or PDSE name without specifying a member. You can open the directory only for read; update and write modes are not allowed. The only RECFM that you can specify for reading the directory is RECFM=U. However, you do not need to specify the RECFM, because z/OS XL C/C++ uses U as the default.

z/OS DFSMS Using Data Sets contains more detailed explanations about how to use PDSs and PDSEs.