Partitioned and sequential concatenated data sets

There are two forms of concatenated data sets: partitioned and sequential. You can open concatenated data sets only by ddname, and only for read or update. Specifying any of the write, or append modes fails. As with PDS members, you cannot extend a concatenated data set.

Partitioned concatenation consists of specifying multiple PDSs or PDSEs under one ddname. When you access the concatenation, it acts as one large PDS or PDSE, from which you can access any member. If two or more partitioned data sets in the concatenation contain a member with the same name, using the concatenation ddname to specify that member refers to the first member with that name found in the entire concatenation. You cannot use the ddname to access subsequent members. For example, if you have a PDS named PDS1, with members A, B, and C, and a second PDS named PDS2, with members C, D, and E, and you concatenate the two data sets as follows:
   //MYDD    DD userid.PDS1,DISP=SHR
   //        DD userid.PDS2,DISP=SHR
and perform the following:
   fp = fopen("DD:MYDD(C)","r");
   fp2 = fopen("DD:MYDD(D)","r");

the first call to fopen() finds member C from PDS1, even though there is also a member C in PDS2. The second call finds member D from PDS2, because PDS2 is the first PDS in the concatenation that contains this member. The member C in PDS2 is inaccessible.

When you are concatenating partitioned data sets, be aware of the DCB attributes for them. The concatenation is treated as a single data set with the following attributes:

Table 1 describes the rules for compatible concatenations.

Table 1. Rules for possible concatenations
RECFM of first data set RECFM of subsequent data sets LRECL of subsequent data sets
RECFM=F RECFM=F Same as that of first one
RECFM=FB RECFM=F or RECFM=FB Same as that of first one
RECFM=V RECFM=V Less than or equal to that of first one
RECFM=VS RECFM=V or RECFM=VS Less than or equal to that of first one
RECFM=VB RECFM=V or RECFM=VB Less than or equal to that of first one
RECFM=VBS RECFM=V, RECFM=VB, RECFM=VS, or RECFM=VBS Less than or equal to that of first one
RECFM=U RECFM=U or RECFM=F (see note)  
Note: You can use a data set in V-format, but when you read it, you will see all of the BDWs and RDWs or SDWs with the data.

If the first data set is in ASA format, all subsequent data sets must be ASA as well. The preceding rules apply to ASA files if you add an A to the RECFMs specified.

If you do not follow these rules, undefined behavior occurs. For example, trying to read a fixed-format member as RECFM=V could cause an exception or abend.

Repositioning is supported as it is for regular PDSs and PDSEs. If you try to read the directory, you will be able to read only the first one.

Sequential concatenation consists of treating multiple sequential data sets or partitioned data set members as one long sequential data set.
   //MYDD   DD userid.PDS1(A),DISP=SHR
   //       DD userid.PDS2(E),DISP=SHR
   //       DD userid.DATA,DISP=SHR

creates a concatenation that contains two members and a regular sequential data set. You can read or update all of these in order. In partitioned concatenations, you can read only one member at a time.

z/OS® XL C/C++ does not support concatenating data sets that do not have compatible DCB attributes. The rules for compatibility are the same as those for partitioned concatenations.

If all the data sets in the concatenation support repositioning, you can reposition within a concatenation by using the functions fseek(), ftell(), fgetpos(), fsetpos(), and rewind(). If the first one does not, all of the repositioning functions except rewind() fail for the entire concatenation. If the first data set supports repositioning but a subsequent one does not, you must specify the noseek parameter on the fopen() or freopen() call. If you do not, fopen() or freopen() opens the file successfully; however, an error occurs when the read position gets to the data set that does not support repositioning.

Note: Concatenated and multivolume data sets only tolerate single buffering mode.