Concatenating Datasets

We can retrieve two or more data sets and process them successively as a single sequential data set. This is called sequential concatenation. A sequential concatenation can include sequential data sets, PDS members, PDSE members.

Rules for Concatenation:

  • DDname should be coded for the first DD statement only.
  • The sequence in which the datasets are coded is the sequence in which they are concatenated.
  • We can concatenate PDS, PDS members and PS datasets, but not VSAM datasets. Cannot concatenate PDS entirely with sequential datasets.
  • All datasets must have the same RECFM.
  • The LRECL must also be the same for fixed-length records.
  • LRECL need not be same for variable-length records as long as you place the dataset with the longest LRECL on the first DD statement.
  • BLKSIZE need not be same .
  • You can concatenate as many as 114 PDS as PDSs. No concatenation limit on the PDS members or on PS.
  • Datasets can reside on different devices
  • If dummy dataset is coded, any preceding dataset coded are not processed.
//PROGPUB JOB NOTIFY=&SYSUID,MSGCLASS=A,MSGLEVEL=2
//STEP1   EXEC PGM=PROGRAM1
//INPUT   DD DSN=PROGPUB.FLATFILE.INPUT1,DISP=SHR
//        DD DSN=PROGPUB.FLATFILE.INPUT2,DISP=SHR
//        DD DSN=PROGPUB.FLATFILE.INPUT3,DISP=SHR
//

Example with dummy dataset

//* PROGPUB.FLATFILE.INPUT3 File is not processed
//PROGPUB JOB NOTIFY=&SYSUID,MSGCLASS=A,MSGLEVEL=2
//STEP1   EXEC PGM=PROGRAM1
//INPUT   DD DSN=PROGPUB.FLATFILE.INPUT1,DISP=SHR
//        DD DSN=PROGPUB.FLATFILE.INPUT2,DISP=SHR
//        DD DSN=DUMMY
//        DD DSN=PROGPUB.FLATFILE.INPUT3,DISP=SHR
//