Concatenating Datasets


Concatenating datasets is a process of combining two or more same types of datasets into a single logical dataset that can be accessed as a single unit. Concatenation allows a program to read from multiple datasets one by one without accessing each dataset separately.

To concatenate datasets in JCL, we can use the DD statement and multiple datasets with the one DDname.

Syntax -

//DDname DD DSN=dataset1,...
//       DD DSN=dateset2,...
//       DD  .....
//       DD DSN=datasetn,...

Rules -

The concatenating datasets should be of -

  • Same type
  • Same length
  • Same characterstics

Examples -


Scenario - Concatenating multiple datasets.

//STEP01  EXEC PGM=PROG1
//INPUT   DD   DSN=MATEPK.INPUT.PS,DISP=SHR
//        DD   DSN=MATEPK.INPUT.PS1,DISP=SHR

The two PS files are accessed as a single file under INPUT DDname in PROG1.