Dataset concatenation in JCL allows multiple datasets to be treated as a single logical dataset during job execution. This powerful technique enables programs to process data from multiple sources without requiring modification to handle multiple inputs.
Key Benefit:
Concatenation simplifies data processing by combining multiple input sources, such as libraries, data files, or temporary datasets, allowing programs to access them sequentially as if they were a single dataset.
To concatenate datasets, omit the DD statement name for all datasets after the first one:
123456//ddname DD DSN=dataset1.name, // DISP=SHR // DD DSN=dataset2.name, // DISP=SHR // DD DSN=dataset3.name, // DISP=SHR
The system processes these datasets in the order they appear, creating a virtual combined dataset.
Type | Description | Usage |
---|---|---|
Sequential Dataset Concatenation | Combining multiple sequential datasets | Processing sequential input files or logs in a specific order |
Library Concatenation | Combining multiple partitioned datasets (PDS/PDSE) | Creating search paths for program libraries, JCL procedures, or copybooks |
Mixed Concatenation | Combining different types of datasets (requires compatible attributes) | Special-case processing where different types of data must be combined |
In-stream and Dataset Concatenation | Combining in-stream data with cataloged datasets | Adding job-specific control statements or data to standard input files |
1234567//STEP1 EXEC PGM=MYPGM //STEPLIB DD DSN=USER.PRIVATE.LOADLIB, // DISP=SHR // DD DSN=PROJECT.LOADLIB, // DISP=SHR // DD DSN=SYS1.LINKLIB, // DISP=SHR
This example sets up a search path for executable modules. The system first searches USER.PRIVATE.LOADLIB, then PROJECT.LOADLIB, and finally SYS1.LINKLIB.
1234567891011121314//STEP2 EXEC PGM=SORT //SORTIN DD DSN=USER.DATA.JAN, // DISP=SHR // DD DSN=USER.DATA.FEB, // DISP=SHR // DD DSN=USER.DATA.MAR, // DISP=SHR //SORTOUT DD DSN=USER.DATA.Q1, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920) //SYSIN DD * SORT FIELDS=(1,10,CH,A) /*
This example concatenates three monthly datasets as input to a sort job, producing a combined quarterly dataset.
1234567891011121314//COBCOMP EXEC PGM=IGYCRCTL //SYSLIB DD DSN=USER.COPYLIB, // DISP=SHR // DD DSN=PROJECT.COPYLIB, // DISP=SHR // DD DSN=SYS1.COBLIB, // DISP=SHR //SYSIN DD DSN=USER.COBOL.SOURCE(PROGRAM1), // DISP=SHR //SYSLIN DD DSN=&&OBJMOD, // DISP=(NEW,PASS), // SPACE=(TRK,(5,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200) //SYSPRINT DD SYSOUT=*
This example shows a COBOL compiler with a concatenated SYSLIB for copybook resolution. When the program includes a copybook, the system searches each library in order until it finds the member.
123456789101112131415//STEP4 EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * These are initial control records. /* // DD DSN=USER.CONTROL.DATASET, // DISP=SHR // DD * These are final control records. /* //SYSUT2 DD DSN=USER.COMBINED.CONTROL, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,1)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)
This example combines in-stream data with a cataloged dataset to create a custom control file. This technique allows job-specific data to be combined with standard data.
Factor | Impact | Recommendation |
---|---|---|
Order of Concatenation | Affects search speed for libraries | Place most frequently accessed libraries first in the concatenation |
Number of Datasets | Large numbers of concatenated datasets increase system overhead | Limit concatenation to a reasonable number of datasets (generally under 16) |
Buffer Allocation | System allocates buffers based on the first dataset | Place the dataset with optimal DCB attributes first |
Dataset Location | Accessing datasets on different volumes adds I/O overhead | When possible, keep concatenated datasets on the same volume |
Issue | Possible Causes | Solutions |
---|---|---|
ABEND013-4C | DCB attribute conflict between concatenated datasets |
|
Member not found | Member exists but in a library later in the concatenation with duplicate names earlier |
|
S806-4 (Module not found) | Load module not in concatenated libraries |
|
Unexpected data processing | Data processed in incorrect order |
|
In some cases, you can concatenate datasets with unlike attributes by using special DCB parameters:
1234//INPUT DD DSN=LARGE.RECORDS,DISP=SHR, // DCB=(RECFM=VB,LRECL=8000) // DD DSN=SMALL.RECORDS,DISP=SHR, // DCB=(RECFM=VB,LRECL=100)
In this example, even though SMALL.RECORDS has smaller records than LARGE.RECORDS, the DCB parameter on the second DD statement ensures the system knows how to handle the transition.
12//INPUT DD DSN=&&TEMPDATA,DISP=(OLD,DELETE) // DD DSN=PERMANENT.DATA,DISP=SHR
This example shows concatenation of a temporary dataset (created in a previous step) with a permanent dataset.
You can use symbolic parameters to conditionally include datasets in a concatenation:
12345678//PROCSTEP PROC ENV=PROD //SYSLIB DD DSN=SYS1.MACLIB,DISP=SHR // DD DSN=SYS1.MODGEN,DISP=SHR // DD DSN=USER.MACLIB,DISP=SHR //* // IF &ENV = TEST THEN //TESTLIB DD DSN=TEST.MACLIB,DISP=SHR // ENDIF
In this example, TEST.MACLIB is only included in the concatenation when the procedure is called with ENV=TEST.
Dataset concatenation behavior is generally the same in both JES2 and JES3 environments, but there are some considerations:
Feature | JES2 | JES3 |
---|---|---|
Dataset allocation | All datasets in concatenation are allocated at step execution time | Can pre-allocate datasets in concatenation during setup phase |
SYSIN DD * concatenation | Standard behavior | Enhanced options with JES3 control statements |